Skip to content

Latest commit

 

History

History
130 lines (77 loc) · 3.05 KB

README.md

File metadata and controls

130 lines (77 loc) · 3.05 KB

Shari for Swift

Carthage Version License Platform Reviewed by Hound

Shari is the alternative to the library of UIPickerView (drum roll) in Swift. You can select a item using UITableView.

Shari

Requirements

  • iOS 10.0+
  • Xcode 9+
  • Swift 5+

Swift Package Manager

Add via Xcode in the usual way

CocoaPods

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

pod "Shari"

Then, run the following code:

$ pod install

Carthage

Carthage is a decentralized dependency manager for Cocoa applications.

$ brew update
$ brew install carthage

To integrate Shari into your Xcode project using Carthage, specify it in your Cartfile:

github "nakajijapan/Shari"

Then, run the following command to build the Shari framework:

$ carthage update

Usage

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

ViewController

  • UINavigationController
let modalNavigationController = storyboard!.instantiateViewController(withIdentifier: "ModalNavigationController") as! ShariNavigationController

modalNavigationController.parentNavigationController = navigationController
navigationController?.si.present(modalNavigationController)
  • UITabBarController
let modalNavigationController = storyboard!.instantiateViewController(withIdentifier: "ModalNavigationController") as! ShariNavigationController

modalNavigationController.parentTabBarController = tabBarController
tabBarController?.si.present(modalNavigationController)

You can change background color using following code:

ShariSettings.backgroundColorOfOverlayView = UIColor.redColor()

You can change with following code whether view should transform scale down:

ShariSettings.shouldTransformScaleDown = true

ModalViewController

  • Create NavigationController and ViewController in storyboards.
  • Input Shari.NavigationController in Custom Class for NavigationController.

Shari

Closing a window

You can close using the following code in viewController:

let currentNavigationController = navigationController
currentNavigationController?.si.dismiss {
    // something
}

Author

nakajijapan, [email protected]

License

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