| { |
| "name": "ProtocolOrientedViewModel", |
| "version": "0.0.1", |
| "summary": "Create universal view's with different layouts for each platform and share the view logic between them.", |
| "description": "ProtocolOrientedViewModel\n===\n\nCreate universal view's with different layouts for each platform and share the view logic between them.\n\nRequirements\n----\n\n- Swift 3.0+\n- iOS 8.0+\n- tvOS 9.0+\n- macOS 10.10+\n\nInstall\n----\n\n```\npod 'ProtocolOrientedViewModel'\n```\n\nUsage\n----\n\nThis is most useful for universal ios/tvos/mac projects.\nCreate `Layout`s for your view. For example, portrait and landscape.\nCreate xib's for each layout of each platform or just create them programmaitaclly.\n\n```\nenum HomeScreenLayout: Layout {\ncase portrait\ncase landscape\n\n// Define the type of view\ntypealias View = HomeScreenView\nvar view: HomeScreenView? {\nreturn from xib or create and return them here for each layout.\n}\n}\n```\n\nCreate your view and its delegate with actions.\n\n```\nprotocol HomeScreenViewDelegate: class {\nfunc homeScreenViewDidPressSomething(_ homeScreenView: HomeScreenView)\n...\n}\n\nclass HomeScreenView: POView { // POView is a typealias of NSView and UIView for sharing view.\nweak var delegate: HomeScreenViewDelegate?\n@IBOutlet var someLabel: UILabel?\n\n@IBAction func somethingDidPress() {\ndelegate?.homeScreenViewDidPressSomething(self)\n}\n\n...\n}\n```\n\nAnd create your view model\n\n```\nclass HomeScreenViewModel: ViewModel, HomeScreenViewDelegate {\n\n// MARK: ViewModel\n// define the type of view\ntypealias View = HomeScerenView\nvar view: HomeScrenView?\n\n// Make your updates for your view.\nfunc render() {\nview?.someLabel?.text = dataSource.someValue\nview?...\n}\n\n// MARK: HomeScreenViewDelegate\nfunc homeScreenViewDidPressSomething(_ homeScreenView: HomeScreenView) {\ndataSource.someValue = \"new value\"\nrender()\n}\n\n...\n}\n```\n\nCall `updateLayoutFor:InView:` function on the view model to update layout of your view.\nAlso see the example project for universal usage with multiple layouts with xibs in multiple platforms.", |
| "homepage": "https://github.com/cemolcay/ProtocolOrientedViewModel", |
| "license": "MIT", |
| "authors": { |
| "cemolcay": "ccemolcay@gmail.com" |
| }, |
| "social_media_url": "http://twitter.com/cemolcay", |
| "platforms": { |
| "ios": "8.0", |
| "osx": "10.10", |
| "tvos": "9.0" |
| }, |
| "source": { |
| "git": "https://github.com/cemolcay/ProtocolOrientedViewModel.git", |
| "tag": "0.0.1" |
| }, |
| "source_files": "Source/*.swift", |
| "requires_arc": true, |
| "pushed_with_swift_version": "3.0" |
| } |