Latest 1.0.1
Homepage https://github.com/wess/zenith
License MIT
Platforms ios 11.0

Zenith is a framework for simple and smart seperation of the view controller and view management, leaving your controller to manage interactions and other "controller" like things.
As well as a Router to simplify navigation through your app.

Requirements

  • iOS 11.0+
  • Xcode 9.0
  • Swift 4.0

Installation

CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift.
To learn more about setting up your project for CocoaPods, please refer to the official documentation.
To integrate Zenith into your Xcode project using CocoaPods, you have to add it to your project’s Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

use_frameworks!

target '<Your Target Name>' do
  pod 'Zenith', '~> 1.0'
end

Afterwards, run the following command:

$ pod install

Usage

Zenith allows the view controller to hand off view layout and management to a component.

import UIKit
import Zenith

class MyViewComponent : ViewComponent {
  private lazy var label:UILabel = {
    let label = UILabel()
    label.textAlignment = .center
    label.text = "Hello, world"

    return label
  }()

  override setupConstraints() {
    label.addConstraints([
      // Add constraints here
    ])
  }

  override render() -> UIView {
    return children(
     label
    )
  }
}

class MyViewController : ViewController<MyViewComponent> {
  // Your view controller will now load the component and
  // present it, like normal.
}

Zenith also features a router to simplify navigation.

import Zenith

enum MyRoute : RouteOption {
  case home
  case about

  var controller:UIViewController {
    switch self {
    case .home:
      return UINavigationController(rootViewController: MyHomeViewController)
    case .about:
      return UINavigationController(rootViewController: MyAboutViewController)
    }
  }
}

// Create an instance of your router, where you can access it anywhere.

let router = Router<MyRoute>()
router.move(.home)

Credits

Zenith is written and maintained by Wess Cope.
Twitter: @wesscope.

License

Zenith is released under the MIT License.
See LICENSE for details.

Latest podspec

{
    "name": "Zenith",
    "version": "1.0.1",
    "summary": "Functional-ish platform witha touch of the fluxes",
    "description": "A nice little library for introducing a few things from Elixir land",
    "homepage": "https://github.com/wess/zenith",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Wess Cope",
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/wess/zenith.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "Sources/**/*.swift",
        "Sources/*.swift"
    ]
}

Pin It on Pinterest

Share This