Swiftpack.co -  mgray88/Allegory as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
mgray88/Allegory
SwiftUI but UIKit
.package(url: "https://github.com/mgray88/Allegory.git", from: "0.0.2")

Allegory

SwiftUI but UIKit (plus a little RxSwift)

Allegory is a library built to resemble SwiftUI as much as possible built on top of UIKit for use on iOS versions starting from iOS 10.

See Progress

Example

Allegory is designed to be almost identical to SwiftUI, except that the body of your views returns SomeView instead of some View.

struct Counter: View {
    @State var count: Int
    let limit: Int

    var body: SomeView {
        if count < limit {
            VStack {
                Button("Increment") { count += 1 }
                Text("\(count)")
            }
            // Not yet implemented
            // .onAppear { print("Counter.VStack onAppear") }
            // .onDisappear { print("Counter.VStack onDisappear") }
        } else {
            VStack { Text("Limit exceeded") }
        }
    }
}

@main
struct CounterApp: App {
    var body: SomeScene {
        WindowGroup("Counter Demo") {
            Counter(count: 5, limit: 15)
        }
    }
}

Installation

With CocoaPods

Add the following line to your Podfile:

pod 'Allegory', '~> 0.0.2'

With Swift Package Manager

In Xcode 12.3+ go to File -> Swift Packages -> Add Package Dependency and enter there URL of this repo

https://github.com/mgray88/Allegory

WIP

Allegory is a highly dynamic work in progress. Much of it is not ready for use.

Author

Mike Gray

Acknowledgements

Many, many thanks to these other open source projects and resources that have inspired and provided insight on the inner workings of SwiftUI

SwiftUI is a trademark owned by Apple Inc. Software maintained as a part of the Allegory project is not affiliated with Apple Inc.

License

Allegory is available under the MIT license. See LICENSE for more info.

GitHub

link
Stars: 0
Last commit: 16 hours ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics