2 "name": "ProtocolOrientedViewModel",
4 "summary": "Create universal view's with different layouts for each platform and share the view logic between them.",
5 "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.",
6 "homepage": "https://github.com/cemolcay/ProtocolOrientedViewModel",
9 "cemolcay": "ccemolcay@gmail.com"
11 "social_media_url": "http://twitter.com/cemolcay",
18 "git": "https://github.com/cemolcay/ProtocolOrientedViewModel.git",
21 "source_files": "Source/*.swift",
23 "pushed_with_swift_version": "3.0"