Swiftpack.co -  bugkingK/RxViewController as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
RxViewController is a library for the development with MVVM-C based on RxSwift.
.package(url: "https://github.com/bugkingK/RxViewController.git", from: "1.1.0")



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



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.


bugkingK, myway0710@naver.com


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


Stars: 3
Last commit: 5 days 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.


Related Packages

Release Notes

5 days ago

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