Fake SwiftUI based on UIKit & RxSwift

FakeSwiftUI

Fake SwiftUI based on UIKit & RxSwift.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Text

Preview Code
import FakeSwiftUI
import RxSwift
import RxRelay

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        Text("FakeSwiftUI Rocks")
            .color(.white)
            .font(40)
            .clipShape(Circle())
            .overlay(Circle().stroke([.blue, .yellow], lineWidth: 4))
            .padding(.symmetric(4, 16))
            .background([UIColor.red, .blue])
            .centerX(offset: 0)
            .centerY(offset: 0)
            .on(view)
    }
}
let degree$ = Observable<Int>.timer(
   .seconds(1),
   period: .milliseconds(5),
   scheduler: MainScheduler.instance
)
   .map{ Double($0).truncatingRemainder(dividingBy: 360.0) }
     
ZStack(
   View()
       .mask(
           Text("FakeSwiftUI Rocks")

               .font(40)
               .padding(.symmetric(4, 16))
   )
       .background([UIColor.red, .blue], degree$: degree$)
       .fill()
)
   .background(.black)
   .clipShape(Circle())
   .overlay(Circle().stroke([.green, .yellow], degree$: degree$, lineWidth: 4))
   .centerX(offset: 0)
   .centerY(offset: 0)
   .on(view)

Requirements

Installation

FakeSwiftUI is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'FakeSwiftUI', git => 'https://github.com/dexterliu1214/FakeSwiftUI'

Author

dexterliu1214@gmail.com

GitHub