Swiftpack.co - bugkingK/RxViewController as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bugkingK.
bugkingK/RxViewController 1.3.2
RxViewController is a library for the development with MVVM-C based on RxSwift.
⭐️ 4
🕓 2 years ago
iOS macOS
.package(url: "https://github.com/bugkingK/RxViewController.git", from: "1.3.2")

RxViewController

Swift

RxViewController is a library for the development with MVVM-C based on RxSwift.

RxController provides the the following basic view controller and view model classes.

  • RxViewController
  • RxViewModel

Installation

Manual:

Copy RxViewController folder to your project.

Swift Package Manager:

You can use The Swift Package Manager to install RxViewController by adding the proper description to your Package.swift file:


let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .package(url: "https://github.com/bugkingK/RxViewController.git", from: "1.0.0"),
    ]
)

Then run swift build whenever you get prepared.

Generic class of View Controller

RxController provides a generic classes RxViewController. It avoids using an Optional or an Implicit Unwrapping Option type for the view model property in the view controller class.

In the demo app, we define the view model class by extending the RxViewModel class, and the view controller class by extending the RxViewController generic class.

// View model class
final class HomeViewModel: RxViewModel {

}

// View controller class
final class HomeViewController: RxViewController<HomeViewModel> {

}

RxViewController LifeCycle

Defines the various layout properties of the 'UIViewController'.

  • open func layout()

Used when a change to the Cocoa dependency properties that should be injected at 'init()' time is required. ⚠️ Caution: Changing properties other than the init point in time may affect the viewDidLoad point in time

  • open func initialize()

Binding properties of 'RxViewModel' and each component, In 'bind', it is possible to perform both the definition behavior and the change in location of variable properties.

  • func bind(_ viewModel: ViewModel)

Used to initialize with code without storyboard and inject ViewModel.

  • init(viewModel: ViewModel)

Used to initialize with storyboard and inject ViewModel. To use this method, override the init of ViewModel.

  • static func initWith(viewModel: RxViewModel) -> Self

RxViewModel Init with Storyboard

Used to initialize to the storyboard.

  • public init(storyboardID: String, identifier: String, bundle: Bundle)

Used to initialize with UINib.

  • public init(nibName: String?, bundle: Bundle

When initializing using the storyboard, either of the above methods must be overridden before the public init(storyboardID: String, identifier: String, bundle: Bundle) method can be executed.

Author

bugkingK, [email protected]

License

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

GitHub

link
Stars: 4
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Related Packages

Release Notes

1.3.2
2 years ago

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