TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2021 |
SPMSupports SPM | ✓ |
Maintained by incetro.
VIPER is a framework written in Swift that makes it easy for you to build VIPER architecture more conveniently and easily
This component makes transition between VIPER modules
/// With 'present' option
transitionHandler?.openModule(usingFactory: factory, type: SecondModuleInput.self)
.to(preferred: TransitionStyle.present)
.then { moduleInput in
moduleInput.setData(data)
}
/// Or with 'navigationController' options
transitionHandler?.openModule(usingFactory: factory, type: SecondModuleInput.self)
.to(preferred: TransitionStyle.navigationController(navigationStyle: .push))
.then { moduleInput in
moduleInput.setData(data)
}
transitionHandler?.performSegue(segueIdentifier)
/// Or with setup block
transitionHandler?.openModuleUsingSegue(with: segueIdentifier, to: SecondModuleInput.self) { moduleInput in
moduleInput.setData(data)
}
transitionHandler?.closeCurrentModule(true)
This component can help you to show different states of View
/// Start showing progress
view?.startIndication()
/// Stop progress
view?.stopIndication()
/// Show unknown error's message
view?.showError()
/// Show success view
view?.showSuccess()
/// Show the given message
view?.showMessage("Message")
/// Show the given error message
view?.showErrorMessage("Error message")
This component facilitates the work with assemblies.
class YourModuleAssembly: CollectableAssembly {
required init() {
}
/// Register your dependencies through Swinject.
/// You may not call this method because
/// AssembliesCollector automatically call it :)
func assemble(in container: Container) {
}
}
How can you use InteractorOutput, ContentManager, ModuleInput, ModuleOutput? See the example ;)
If you prefer not to use any dependency managers, you can integrate Viper into your project manually.
Open up Terminal, cd
into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
Add Viper as a git submodule by running the following command:
$ git submodule add https://github.com/incetro/Viper.git
Open the new Viper
folder, and drag the Viper.xcodeproj
into the Project Navigator of your application's Xcode project.
It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
Select the Viper.xcodeproj
in the Project Navigator and verify the deployment target matches that of your application target.
Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
In the tab bar at the top of that window, open the "General" panel.
Click on the +
button under the "Embedded Binaries" section.
You will see two different Viper.xcodeproj
folders each with two different versions of the Viper.framework
nested inside a Products
folder.
It does not matter which
Products
folder you choose from, but it does matter whether you choose the top or bottomViper.framework
.
Select the top Viper.framework
for iOS and the bottom one for OS X.
And that's it!
The
Viper.framework
is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
incetro, incetro@ya.ru. Inspired by ViperMcFlurry
VIPER is available under the MIT license. See the LICENSE file for more info.