├── .gitignore ├── LICENSE ├── Mineral Demo ├── AbsoluteViewController.swift ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FlexViewController.swift ├── Info.plist ├── RelativeViewController.swift └── ViewController.swift ├── Mineral.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Mineral.xcworkspace └── contents.xcworkspacedata ├── Mineral ├── AbsoluteContainer.swift ├── Buildable.swift ├── Builder.swift ├── Button.swift ├── Container.swift ├── FlexContainer.swift ├── Info.plist ├── Mineral.h ├── Mineral.swift ├── Node.swift ├── Relation.swift ├── RelativeContainer.swift └── UIView+Measure.swift ├── Podfile ├── Podfile.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | 62 | .DS_Store 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Draveness 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Mineral Demo/AbsoluteViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AbsoluteViewController.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 11/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Mineral 11 | 12 | class AbsoluteViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let frame = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) 18 | Builder.build.color(UIColor.white).size(50) 19 | .attachTo(frame).origin(10) 20 | Builder.build.color(UIColor.red).size(50) 21 | .attachTo(frame).center(200, 300) 22 | 23 | view.addSubview(frame.view) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Mineral Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Mineral Demo 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Mineral 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Mineral Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Mineral Demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Mineral Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Mineral Demo/FlexViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FlexViewController.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 18/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Mineral 11 | 12 | class FlexViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | 18 | let flexbox = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) { container in 19 | Builder.build 20 | .color(UIColor.white) 21 | .size(100) 22 | .attachTo(container) 23 | Builder.build.color(UIColor.red).size(100).attachTo(container) 24 | } 25 | 26 | view.addSubview(flexbox.view) 27 | 28 | flexbox.view.yoga.applyLayout(preservingOrigin: true) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Mineral Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Mineral Demo/RelativeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RelativeViewController.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 11/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Mineral 11 | import SnapKit 12 | 13 | class RelativeViewController: UIViewController { 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | let constraint = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) 19 | 20 | let node = Builder.build.color(UIColor.white).size(50) 21 | .attachTo(constraint) 22 | .left(constraint) 23 | .top(constraint, offset: 20).node 24 | 25 | Builder.build.color(UIColor.red).size(50) 26 | .attachTo(constraint) 27 | .left(node.rlt.right) 28 | .centerY(node) 29 | 30 | view.addSubview(constraint.view) 31 | constraint.view.snp.makeConstraints { (make) in 32 | make.edges.equalToSuperview() 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Mineral Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Mineral Demo 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UITableViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | } 16 | 17 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 18 | return 3 19 | } 20 | 21 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 22 | let cell = UITableViewCell(style: .default, reuseIdentifier: nil) 23 | switch indexPath.row { 24 | case 0: 25 | cell.textLabel?.text = "Absolute" 26 | case 1: 27 | cell.textLabel?.text = "Relative" 28 | default: 29 | cell.textLabel?.text = "Flex" 30 | } 31 | return cell 32 | } 33 | 34 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 35 | let index = indexPath.row 36 | switch index { 37 | case 0: 38 | self.navigationController?.pushViewController(AbsoluteViewController(), animated: true) 39 | case 1: 40 | self.navigationController?.pushViewController(RelativeViewController(), animated: true) 41 | default: 42 | self.navigationController?.pushViewController(FlexViewController(), animated: true) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Mineral.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7200E6931ECD956900311FA3 /* FlexContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7200E6921ECD956900311FA3 /* FlexContainer.swift */; }; 11 | 7200E6951ECD97BF00311FA3 /* FlexViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7200E6941ECD97BF00311FA3 /* FlexViewController.swift */; }; 12 | 720857D51ED8307C008AAD38 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720857D41ED8307C008AAD38 /* Button.swift */; }; 13 | 7291CC9F1E9FB7AC0033BAEC /* Mineral.h in Headers */ = {isa = PBXBuildFile; fileRef = 7291CC9D1E9FB7AC0033BAEC /* Mineral.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 7291CCA61E9FB7B30033BAEC /* Mineral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCA51E9FB7B30033BAEC /* Mineral.swift */; }; 15 | 7291CCAA1E9FB8560033BAEC /* Node.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCA91E9FB8560033BAEC /* Node.swift */; }; 16 | 7291CCAC1E9FB8870033BAEC /* AbsoluteContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCAB1E9FB8870033BAEC /* AbsoluteContainer.swift */; }; 17 | 7291CCAE1E9FBCD90033BAEC /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCAD1E9FBCD90033BAEC /* Container.swift */; }; 18 | 7291CCB61E9FD3B10033BAEC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCB51E9FD3B10033BAEC /* AppDelegate.swift */; }; 19 | 7291CCB81E9FD3B10033BAEC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCB71E9FD3B10033BAEC /* ViewController.swift */; }; 20 | 7291CCBB1E9FD3B10033BAEC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7291CCB91E9FD3B10033BAEC /* Main.storyboard */; }; 21 | 7291CCBD1E9FD3B10033BAEC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7291CCBC1E9FD3B10033BAEC /* Assets.xcassets */; }; 22 | 7291CCC01E9FD3B10033BAEC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7291CCBE1E9FD3B10033BAEC /* LaunchScreen.storyboard */; }; 23 | 7291CCC81EA063DD0033BAEC /* Builder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCC71EA063DD0033BAEC /* Builder.swift */; }; 24 | 7291CCCA1EA064320033BAEC /* Buildable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7291CCC91EA064320033BAEC /* Buildable.swift */; }; 25 | 72F480EF1EC4016E009A7EAA /* RelativeContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F480EE1EC4016E009A7EAA /* RelativeContainer.swift */; }; 26 | 72F480F11EC401B0009A7EAA /* Relation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F480F01EC401B0009A7EAA /* Relation.swift */; }; 27 | 72F480F51EC406A7009A7EAA /* RelativeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F480F41EC406A7009A7EAA /* RelativeViewController.swift */; }; 28 | 72F480F71EC406AF009A7EAA /* AbsoluteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72F480F61EC406AF009A7EAA /* AbsoluteViewController.swift */; }; 29 | 72FF89461EBC6CBA00022B33 /* UIView+Measure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72FF89451EBC6CBA00022B33 /* UIView+Measure.swift */; }; 30 | 8F5EF9B8F5F44C0495CBE2A1 /* Pods_Mineral.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B03662F853B342972D6450E4 /* Pods_Mineral.framework */; }; 31 | 95A7E0642455689DFDBB9755 /* Pods_Mineral_Demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 196EC15A292F0845DADD0881 /* Pods_Mineral_Demo.framework */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXContainerItemProxy section */ 35 | 7291CCC51E9FD5790033BAEC /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 7291CC911E9FB7AC0033BAEC /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 7291CC991E9FB7AC0033BAEC; 40 | remoteInfo = Mineral; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 031F41C41229F1919EEA8DA1 /* Pods-Mineral.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mineral.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Mineral/Pods-Mineral.debug.xcconfig"; sourceTree = ""; }; 46 | 196EC15A292F0845DADD0881 /* Pods_Mineral_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Mineral_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 1B5125430F2EE97448431529 /* Pods-Mineral Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mineral Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-Mineral Demo/Pods-Mineral Demo.release.xcconfig"; sourceTree = ""; }; 48 | 7200E6921ECD956900311FA3 /* FlexContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlexContainer.swift; sourceTree = ""; }; 49 | 7200E6941ECD97BF00311FA3 /* FlexViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlexViewController.swift; sourceTree = ""; }; 50 | 720857D41ED8307C008AAD38 /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; 51 | 7291CC9A1E9FB7AC0033BAEC /* Mineral.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mineral.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 7291CC9D1E9FB7AC0033BAEC /* Mineral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Mineral.h; sourceTree = ""; }; 53 | 7291CC9E1E9FB7AC0033BAEC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 7291CCA51E9FB7B30033BAEC /* Mineral.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mineral.swift; sourceTree = ""; }; 55 | 7291CCA91E9FB8560033BAEC /* Node.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Node.swift; sourceTree = ""; }; 56 | 7291CCAB1E9FB8870033BAEC /* AbsoluteContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AbsoluteContainer.swift; sourceTree = ""; }; 57 | 7291CCAD1E9FBCD90033BAEC /* Container.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; 58 | 7291CCB31E9FD3B10033BAEC /* Mineral Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mineral Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 7291CCB51E9FD3B10033BAEC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 60 | 7291CCB71E9FD3B10033BAEC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 61 | 7291CCBA1E9FD3B10033BAEC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 62 | 7291CCBC1E9FD3B10033BAEC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 63 | 7291CCBF1E9FD3B10033BAEC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 64 | 7291CCC11E9FD3B10033BAEC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65 | 7291CCC71EA063DD0033BAEC /* Builder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Builder.swift; sourceTree = ""; }; 66 | 7291CCC91EA064320033BAEC /* Buildable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Buildable.swift; sourceTree = ""; }; 67 | 72F480EE1EC4016E009A7EAA /* RelativeContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelativeContainer.swift; sourceTree = ""; }; 68 | 72F480F01EC401B0009A7EAA /* Relation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Relation.swift; sourceTree = ""; }; 69 | 72F480F41EC406A7009A7EAA /* RelativeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelativeViewController.swift; sourceTree = ""; }; 70 | 72F480F61EC406AF009A7EAA /* AbsoluteViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AbsoluteViewController.swift; sourceTree = ""; }; 71 | 72FF89451EBC6CBA00022B33 /* UIView+Measure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Measure.swift"; sourceTree = ""; }; 72 | 9438A0F36E2377B8DDC02CD7 /* Pods-Mineral Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mineral Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Mineral Demo/Pods-Mineral Demo.debug.xcconfig"; sourceTree = ""; }; 73 | AA6DEE59745A7CCEB1FBBB6A /* Pods-Mineral.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mineral.release.xcconfig"; path = "Pods/Target Support Files/Pods-Mineral/Pods-Mineral.release.xcconfig"; sourceTree = ""; }; 74 | B03662F853B342972D6450E4 /* Pods_Mineral.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Mineral.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | /* End PBXFileReference section */ 76 | 77 | /* Begin PBXFrameworksBuildPhase section */ 78 | 7291CC961E9FB7AC0033BAEC /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | 8F5EF9B8F5F44C0495CBE2A1 /* Pods_Mineral.framework in Frameworks */, 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 7291CCB01E9FD3B10033BAEC /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | 95A7E0642455689DFDBB9755 /* Pods_Mineral_Demo.framework in Frameworks */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | 7291CC901E9FB7AC0033BAEC = { 98 | isa = PBXGroup; 99 | children = ( 100 | 7291CC9C1E9FB7AC0033BAEC /* Mineral */, 101 | 7291CCB41E9FD3B10033BAEC /* Mineral Demo */, 102 | 7291CC9B1E9FB7AC0033BAEC /* Products */, 103 | D1F52FB150E362218A171B74 /* Pods */, 104 | CB16DD9E3D14563F42C7BB97 /* Frameworks */, 105 | ); 106 | sourceTree = ""; 107 | }; 108 | 7291CC9B1E9FB7AC0033BAEC /* Products */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 7291CC9A1E9FB7AC0033BAEC /* Mineral.framework */, 112 | 7291CCB31E9FD3B10033BAEC /* Mineral Demo.app */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 7291CC9C1E9FB7AC0033BAEC /* Mineral */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 72F480F31EC4033E009A7EAA /* Helper */, 121 | 72F480F21EC40263009A7EAA /* Container */, 122 | 7291CC9D1E9FB7AC0033BAEC /* Mineral.h */, 123 | 7291CC9E1E9FB7AC0033BAEC /* Info.plist */, 124 | 7291CCA51E9FB7B30033BAEC /* Mineral.swift */, 125 | 7291CCA91E9FB8560033BAEC /* Node.swift */, 126 | 720857D41ED8307C008AAD38 /* Button.swift */, 127 | 7291CCC71EA063DD0033BAEC /* Builder.swift */, 128 | 7291CCC91EA064320033BAEC /* Buildable.swift */, 129 | ); 130 | path = Mineral; 131 | sourceTree = ""; 132 | }; 133 | 7291CCB41E9FD3B10033BAEC /* Mineral Demo */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 7291CCB51E9FD3B10033BAEC /* AppDelegate.swift */, 137 | 7291CCB71E9FD3B10033BAEC /* ViewController.swift */, 138 | 72F480F61EC406AF009A7EAA /* AbsoluteViewController.swift */, 139 | 72F480F41EC406A7009A7EAA /* RelativeViewController.swift */, 140 | 7200E6941ECD97BF00311FA3 /* FlexViewController.swift */, 141 | 7291CCB91E9FD3B10033BAEC /* Main.storyboard */, 142 | 7291CCBC1E9FD3B10033BAEC /* Assets.xcassets */, 143 | 7291CCBE1E9FD3B10033BAEC /* LaunchScreen.storyboard */, 144 | 7291CCC11E9FD3B10033BAEC /* Info.plist */, 145 | ); 146 | path = "Mineral Demo"; 147 | sourceTree = ""; 148 | }; 149 | 72F480F21EC40263009A7EAA /* Container */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 7291CCAB1E9FB8870033BAEC /* AbsoluteContainer.swift */, 153 | 72F480EE1EC4016E009A7EAA /* RelativeContainer.swift */, 154 | 7200E6921ECD956900311FA3 /* FlexContainer.swift */, 155 | 7291CCAD1E9FBCD90033BAEC /* Container.swift */, 156 | 72F480F01EC401B0009A7EAA /* Relation.swift */, 157 | ); 158 | name = Container; 159 | sourceTree = ""; 160 | }; 161 | 72F480F31EC4033E009A7EAA /* Helper */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 72FF89451EBC6CBA00022B33 /* UIView+Measure.swift */, 165 | ); 166 | name = Helper; 167 | sourceTree = ""; 168 | }; 169 | CB16DD9E3D14563F42C7BB97 /* Frameworks */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | B03662F853B342972D6450E4 /* Pods_Mineral.framework */, 173 | 196EC15A292F0845DADD0881 /* Pods_Mineral_Demo.framework */, 174 | ); 175 | name = Frameworks; 176 | sourceTree = ""; 177 | }; 178 | D1F52FB150E362218A171B74 /* Pods */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 031F41C41229F1919EEA8DA1 /* Pods-Mineral.debug.xcconfig */, 182 | AA6DEE59745A7CCEB1FBBB6A /* Pods-Mineral.release.xcconfig */, 183 | 9438A0F36E2377B8DDC02CD7 /* Pods-Mineral Demo.debug.xcconfig */, 184 | 1B5125430F2EE97448431529 /* Pods-Mineral Demo.release.xcconfig */, 185 | ); 186 | name = Pods; 187 | sourceTree = ""; 188 | }; 189 | /* End PBXGroup section */ 190 | 191 | /* Begin PBXHeadersBuildPhase section */ 192 | 7291CC971E9FB7AC0033BAEC /* Headers */ = { 193 | isa = PBXHeadersBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | 7291CC9F1E9FB7AC0033BAEC /* Mineral.h in Headers */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXHeadersBuildPhase section */ 201 | 202 | /* Begin PBXNativeTarget section */ 203 | 7291CC991E9FB7AC0033BAEC /* Mineral */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = 7291CCA21E9FB7AC0033BAEC /* Build configuration list for PBXNativeTarget "Mineral" */; 206 | buildPhases = ( 207 | 497C851A7D70B2756F2A4A1E /* [CP] Check Pods Manifest.lock */, 208 | 7291CC951E9FB7AC0033BAEC /* Sources */, 209 | 7291CC961E9FB7AC0033BAEC /* Frameworks */, 210 | 7291CC971E9FB7AC0033BAEC /* Headers */, 211 | 7291CC981E9FB7AC0033BAEC /* Resources */, 212 | 7AE54A98CA30803A35063E7A /* [CP] Copy Pods Resources */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | ); 218 | name = Mineral; 219 | productName = Mineral; 220 | productReference = 7291CC9A1E9FB7AC0033BAEC /* Mineral.framework */; 221 | productType = "com.apple.product-type.framework"; 222 | }; 223 | 7291CCB21E9FD3B10033BAEC /* Mineral Demo */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 7291CCC21E9FD3B10033BAEC /* Build configuration list for PBXNativeTarget "Mineral Demo" */; 226 | buildPhases = ( 227 | B60B8F07E8B74289798614BD /* [CP] Check Pods Manifest.lock */, 228 | 7291CCAF1E9FD3B10033BAEC /* Sources */, 229 | 7291CCB01E9FD3B10033BAEC /* Frameworks */, 230 | 7291CCB11E9FD3B10033BAEC /* Resources */, 231 | F21625A5000CD1741BD76E90 /* [CP] Embed Pods Frameworks */, 232 | AE014AA29ECD4566A5FD3A2C /* [CP] Copy Pods Resources */, 233 | ); 234 | buildRules = ( 235 | ); 236 | dependencies = ( 237 | 7291CCC61E9FD5790033BAEC /* PBXTargetDependency */, 238 | ); 239 | name = "Mineral Demo"; 240 | productName = "Mineral Demo"; 241 | productReference = 7291CCB31E9FD3B10033BAEC /* Mineral Demo.app */; 242 | productType = "com.apple.product-type.application"; 243 | }; 244 | /* End PBXNativeTarget section */ 245 | 246 | /* Begin PBXProject section */ 247 | 7291CC911E9FB7AC0033BAEC /* Project object */ = { 248 | isa = PBXProject; 249 | attributes = { 250 | LastSwiftUpdateCheck = 0830; 251 | LastUpgradeCheck = 0830; 252 | ORGANIZATIONNAME = draveness; 253 | TargetAttributes = { 254 | 7291CC991E9FB7AC0033BAEC = { 255 | CreatedOnToolsVersion = 8.3.1; 256 | LastSwiftMigration = 0830; 257 | ProvisioningStyle = Automatic; 258 | }; 259 | 7291CCB21E9FD3B10033BAEC = { 260 | CreatedOnToolsVersion = 8.3.1; 261 | ProvisioningStyle = Automatic; 262 | }; 263 | }; 264 | }; 265 | buildConfigurationList = 7291CC941E9FB7AC0033BAEC /* Build configuration list for PBXProject "Mineral" */; 266 | compatibilityVersion = "Xcode 3.2"; 267 | developmentRegion = English; 268 | hasScannedForEncodings = 0; 269 | knownRegions = ( 270 | en, 271 | Base, 272 | ); 273 | mainGroup = 7291CC901E9FB7AC0033BAEC; 274 | productRefGroup = 7291CC9B1E9FB7AC0033BAEC /* Products */; 275 | projectDirPath = ""; 276 | projectRoot = ""; 277 | targets = ( 278 | 7291CC991E9FB7AC0033BAEC /* Mineral */, 279 | 7291CCB21E9FD3B10033BAEC /* Mineral Demo */, 280 | ); 281 | }; 282 | /* End PBXProject section */ 283 | 284 | /* Begin PBXResourcesBuildPhase section */ 285 | 7291CC981E9FB7AC0033BAEC /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | 7291CCB11E9FD3B10033BAEC /* Resources */ = { 293 | isa = PBXResourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 7291CCC01E9FD3B10033BAEC /* LaunchScreen.storyboard in Resources */, 297 | 7291CCBD1E9FD3B10033BAEC /* Assets.xcassets in Resources */, 298 | 7291CCBB1E9FD3B10033BAEC /* Main.storyboard in Resources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXResourcesBuildPhase section */ 303 | 304 | /* Begin PBXShellScriptBuildPhase section */ 305 | 497C851A7D70B2756F2A4A1E /* [CP] Check Pods Manifest.lock */ = { 306 | isa = PBXShellScriptBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | ); 310 | inputPaths = ( 311 | ); 312 | name = "[CP] Check Pods Manifest.lock"; 313 | outputPaths = ( 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | shellPath = /bin/sh; 317 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 318 | showEnvVarsInLog = 0; 319 | }; 320 | 7AE54A98CA30803A35063E7A /* [CP] Copy Pods Resources */ = { 321 | isa = PBXShellScriptBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | ); 325 | inputPaths = ( 326 | ); 327 | name = "[CP] Copy Pods Resources"; 328 | outputPaths = ( 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | shellPath = /bin/sh; 332 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Mineral/Pods-Mineral-resources.sh\"\n"; 333 | showEnvVarsInLog = 0; 334 | }; 335 | AE014AA29ECD4566A5FD3A2C /* [CP] Copy Pods Resources */ = { 336 | isa = PBXShellScriptBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | ); 340 | inputPaths = ( 341 | ); 342 | name = "[CP] Copy Pods Resources"; 343 | outputPaths = ( 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | shellPath = /bin/sh; 347 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Mineral Demo/Pods-Mineral Demo-resources.sh\"\n"; 348 | showEnvVarsInLog = 0; 349 | }; 350 | B60B8F07E8B74289798614BD /* [CP] Check Pods Manifest.lock */ = { 351 | isa = PBXShellScriptBuildPhase; 352 | buildActionMask = 2147483647; 353 | files = ( 354 | ); 355 | inputPaths = ( 356 | ); 357 | name = "[CP] Check Pods Manifest.lock"; 358 | outputPaths = ( 359 | ); 360 | runOnlyForDeploymentPostprocessing = 0; 361 | shellPath = /bin/sh; 362 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 363 | showEnvVarsInLog = 0; 364 | }; 365 | F21625A5000CD1741BD76E90 /* [CP] Embed Pods Frameworks */ = { 366 | isa = PBXShellScriptBuildPhase; 367 | buildActionMask = 2147483647; 368 | files = ( 369 | ); 370 | inputPaths = ( 371 | ); 372 | name = "[CP] Embed Pods Frameworks"; 373 | outputPaths = ( 374 | ); 375 | runOnlyForDeploymentPostprocessing = 0; 376 | shellPath = /bin/sh; 377 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Mineral Demo/Pods-Mineral Demo-frameworks.sh\"\n"; 378 | showEnvVarsInLog = 0; 379 | }; 380 | /* End PBXShellScriptBuildPhase section */ 381 | 382 | /* Begin PBXSourcesBuildPhase section */ 383 | 7291CC951E9FB7AC0033BAEC /* Sources */ = { 384 | isa = PBXSourcesBuildPhase; 385 | buildActionMask = 2147483647; 386 | files = ( 387 | 7291CCA61E9FB7B30033BAEC /* Mineral.swift in Sources */, 388 | 72F480F11EC401B0009A7EAA /* Relation.swift in Sources */, 389 | 72F480EF1EC4016E009A7EAA /* RelativeContainer.swift in Sources */, 390 | 7291CCAE1E9FBCD90033BAEC /* Container.swift in Sources */, 391 | 7200E6931ECD956900311FA3 /* FlexContainer.swift in Sources */, 392 | 7291CCAC1E9FB8870033BAEC /* AbsoluteContainer.swift in Sources */, 393 | 7291CCCA1EA064320033BAEC /* Buildable.swift in Sources */, 394 | 72FF89461EBC6CBA00022B33 /* UIView+Measure.swift in Sources */, 395 | 7291CCAA1E9FB8560033BAEC /* Node.swift in Sources */, 396 | 7291CCC81EA063DD0033BAEC /* Builder.swift in Sources */, 397 | 720857D51ED8307C008AAD38 /* Button.swift in Sources */, 398 | ); 399 | runOnlyForDeploymentPostprocessing = 0; 400 | }; 401 | 7291CCAF1E9FD3B10033BAEC /* Sources */ = { 402 | isa = PBXSourcesBuildPhase; 403 | buildActionMask = 2147483647; 404 | files = ( 405 | 72F480F51EC406A7009A7EAA /* RelativeViewController.swift in Sources */, 406 | 72F480F71EC406AF009A7EAA /* AbsoluteViewController.swift in Sources */, 407 | 7291CCB81E9FD3B10033BAEC /* ViewController.swift in Sources */, 408 | 7200E6951ECD97BF00311FA3 /* FlexViewController.swift in Sources */, 409 | 7291CCB61E9FD3B10033BAEC /* AppDelegate.swift in Sources */, 410 | ); 411 | runOnlyForDeploymentPostprocessing = 0; 412 | }; 413 | /* End PBXSourcesBuildPhase section */ 414 | 415 | /* Begin PBXTargetDependency section */ 416 | 7291CCC61E9FD5790033BAEC /* PBXTargetDependency */ = { 417 | isa = PBXTargetDependency; 418 | target = 7291CC991E9FB7AC0033BAEC /* Mineral */; 419 | targetProxy = 7291CCC51E9FD5790033BAEC /* PBXContainerItemProxy */; 420 | }; 421 | /* End PBXTargetDependency section */ 422 | 423 | /* Begin PBXVariantGroup section */ 424 | 7291CCB91E9FD3B10033BAEC /* Main.storyboard */ = { 425 | isa = PBXVariantGroup; 426 | children = ( 427 | 7291CCBA1E9FD3B10033BAEC /* Base */, 428 | ); 429 | name = Main.storyboard; 430 | sourceTree = ""; 431 | }; 432 | 7291CCBE1E9FD3B10033BAEC /* LaunchScreen.storyboard */ = { 433 | isa = PBXVariantGroup; 434 | children = ( 435 | 7291CCBF1E9FD3B10033BAEC /* Base */, 436 | ); 437 | name = LaunchScreen.storyboard; 438 | sourceTree = ""; 439 | }; 440 | /* End PBXVariantGroup section */ 441 | 442 | /* Begin XCBuildConfiguration section */ 443 | 7291CCA01E9FB7AC0033BAEC /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ALWAYS_SEARCH_USER_PATHS = NO; 447 | CLANG_ANALYZER_NONNULL = YES; 448 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BOOL_CONVERSION = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 462 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 463 | CLANG_WARN_UNREACHABLE_CODE = YES; 464 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 465 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 466 | COPY_PHASE_STRIP = NO; 467 | CURRENT_PROJECT_VERSION = 1; 468 | DEBUG_INFORMATION_FORMAT = dwarf; 469 | ENABLE_STRICT_OBJC_MSGSEND = YES; 470 | ENABLE_TESTABILITY = YES; 471 | GCC_C_LANGUAGE_STANDARD = gnu99; 472 | GCC_DYNAMIC_NO_PIC = NO; 473 | GCC_NO_COMMON_BLOCKS = YES; 474 | GCC_OPTIMIZATION_LEVEL = 0; 475 | GCC_PREPROCESSOR_DEFINITIONS = ( 476 | "DEBUG=1", 477 | "$(inherited)", 478 | ); 479 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 480 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 481 | GCC_WARN_UNDECLARED_SELECTOR = YES; 482 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 483 | GCC_WARN_UNUSED_FUNCTION = YES; 484 | GCC_WARN_UNUSED_VARIABLE = YES; 485 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 486 | MTL_ENABLE_DEBUG_INFO = YES; 487 | ONLY_ACTIVE_ARCH = YES; 488 | SDKROOT = iphoneos; 489 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 490 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 491 | TARGETED_DEVICE_FAMILY = "1,2"; 492 | VERSIONING_SYSTEM = "apple-generic"; 493 | VERSION_INFO_PREFIX = ""; 494 | }; 495 | name = Debug; 496 | }; 497 | 7291CCA11E9FB7AC0033BAEC /* Release */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | ALWAYS_SEARCH_USER_PATHS = NO; 501 | CLANG_ANALYZER_NONNULL = YES; 502 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 503 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 504 | CLANG_CXX_LIBRARY = "libc++"; 505 | CLANG_ENABLE_MODULES = YES; 506 | CLANG_ENABLE_OBJC_ARC = YES; 507 | CLANG_WARN_BOOL_CONVERSION = YES; 508 | CLANG_WARN_CONSTANT_CONVERSION = YES; 509 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 510 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 511 | CLANG_WARN_EMPTY_BODY = YES; 512 | CLANG_WARN_ENUM_CONVERSION = YES; 513 | CLANG_WARN_INFINITE_RECURSION = YES; 514 | CLANG_WARN_INT_CONVERSION = YES; 515 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 516 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 517 | CLANG_WARN_UNREACHABLE_CODE = YES; 518 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 519 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 520 | COPY_PHASE_STRIP = NO; 521 | CURRENT_PROJECT_VERSION = 1; 522 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 523 | ENABLE_NS_ASSERTIONS = NO; 524 | ENABLE_STRICT_OBJC_MSGSEND = YES; 525 | GCC_C_LANGUAGE_STANDARD = gnu99; 526 | GCC_NO_COMMON_BLOCKS = YES; 527 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 528 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 529 | GCC_WARN_UNDECLARED_SELECTOR = YES; 530 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 531 | GCC_WARN_UNUSED_FUNCTION = YES; 532 | GCC_WARN_UNUSED_VARIABLE = YES; 533 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 534 | MTL_ENABLE_DEBUG_INFO = NO; 535 | SDKROOT = iphoneos; 536 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 537 | TARGETED_DEVICE_FAMILY = "1,2"; 538 | VALIDATE_PRODUCT = YES; 539 | VERSIONING_SYSTEM = "apple-generic"; 540 | VERSION_INFO_PREFIX = ""; 541 | }; 542 | name = Release; 543 | }; 544 | 7291CCA31E9FB7AC0033BAEC /* Debug */ = { 545 | isa = XCBuildConfiguration; 546 | baseConfigurationReference = 031F41C41229F1919EEA8DA1 /* Pods-Mineral.debug.xcconfig */; 547 | buildSettings = { 548 | CLANG_ENABLE_MODULES = YES; 549 | CODE_SIGN_IDENTITY = ""; 550 | DEFINES_MODULE = YES; 551 | DYLIB_COMPATIBILITY_VERSION = 1; 552 | DYLIB_CURRENT_VERSION = 1; 553 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 554 | INFOPLIST_FILE = Mineral/Info.plist; 555 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 556 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 557 | PRODUCT_BUNDLE_IDENTIFIER = org.draveness.Mineral; 558 | PRODUCT_NAME = "$(TARGET_NAME)"; 559 | SKIP_INSTALL = YES; 560 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 561 | SWIFT_VERSION = 3.0; 562 | }; 563 | name = Debug; 564 | }; 565 | 7291CCA41E9FB7AC0033BAEC /* Release */ = { 566 | isa = XCBuildConfiguration; 567 | baseConfigurationReference = AA6DEE59745A7CCEB1FBBB6A /* Pods-Mineral.release.xcconfig */; 568 | buildSettings = { 569 | CLANG_ENABLE_MODULES = YES; 570 | CODE_SIGN_IDENTITY = ""; 571 | DEFINES_MODULE = YES; 572 | DYLIB_COMPATIBILITY_VERSION = 1; 573 | DYLIB_CURRENT_VERSION = 1; 574 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 575 | INFOPLIST_FILE = Mineral/Info.plist; 576 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 577 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 578 | PRODUCT_BUNDLE_IDENTIFIER = org.draveness.Mineral; 579 | PRODUCT_NAME = "$(TARGET_NAME)"; 580 | SKIP_INSTALL = YES; 581 | SWIFT_VERSION = 3.0; 582 | }; 583 | name = Release; 584 | }; 585 | 7291CCC31E9FD3B10033BAEC /* Debug */ = { 586 | isa = XCBuildConfiguration; 587 | baseConfigurationReference = 9438A0F36E2377B8DDC02CD7 /* Pods-Mineral Demo.debug.xcconfig */; 588 | buildSettings = { 589 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 590 | INFOPLIST_FILE = "Mineral Demo/Info.plist"; 591 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 592 | PRODUCT_BUNDLE_IDENTIFIER = "org.draveness.Mineral-Demo"; 593 | PRODUCT_NAME = "$(TARGET_NAME)"; 594 | SWIFT_VERSION = 3.0; 595 | }; 596 | name = Debug; 597 | }; 598 | 7291CCC41E9FD3B10033BAEC /* Release */ = { 599 | isa = XCBuildConfiguration; 600 | baseConfigurationReference = 1B5125430F2EE97448431529 /* Pods-Mineral Demo.release.xcconfig */; 601 | buildSettings = { 602 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 603 | INFOPLIST_FILE = "Mineral Demo/Info.plist"; 604 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 605 | PRODUCT_BUNDLE_IDENTIFIER = "org.draveness.Mineral-Demo"; 606 | PRODUCT_NAME = "$(TARGET_NAME)"; 607 | SWIFT_VERSION = 3.0; 608 | }; 609 | name = Release; 610 | }; 611 | /* End XCBuildConfiguration section */ 612 | 613 | /* Begin XCConfigurationList section */ 614 | 7291CC941E9FB7AC0033BAEC /* Build configuration list for PBXProject "Mineral" */ = { 615 | isa = XCConfigurationList; 616 | buildConfigurations = ( 617 | 7291CCA01E9FB7AC0033BAEC /* Debug */, 618 | 7291CCA11E9FB7AC0033BAEC /* Release */, 619 | ); 620 | defaultConfigurationIsVisible = 0; 621 | defaultConfigurationName = Release; 622 | }; 623 | 7291CCA21E9FB7AC0033BAEC /* Build configuration list for PBXNativeTarget "Mineral" */ = { 624 | isa = XCConfigurationList; 625 | buildConfigurations = ( 626 | 7291CCA31E9FB7AC0033BAEC /* Debug */, 627 | 7291CCA41E9FB7AC0033BAEC /* Release */, 628 | ); 629 | defaultConfigurationIsVisible = 0; 630 | defaultConfigurationName = Release; 631 | }; 632 | 7291CCC21E9FD3B10033BAEC /* Build configuration list for PBXNativeTarget "Mineral Demo" */ = { 633 | isa = XCConfigurationList; 634 | buildConfigurations = ( 635 | 7291CCC31E9FD3B10033BAEC /* Debug */, 636 | 7291CCC41E9FD3B10033BAEC /* Release */, 637 | ); 638 | defaultConfigurationIsVisible = 0; 639 | defaultConfigurationName = Release; 640 | }; 641 | /* End XCConfigurationList section */ 642 | }; 643 | rootObject = 7291CC911E9FB7AC0033BAEC /* Project object */; 644 | } 645 | -------------------------------------------------------------------------------- /Mineral.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Mineral.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Mineral/AbsoluteContainer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MNFrameView.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class AbsoluteContainer: Node, Container { 12 | public override func bind(viewModel: VM) -> AbsoluteContainer { 13 | return self 14 | } 15 | 16 | @discardableResult 17 | public func build(closure: () -> Node) -> Relation { 18 | let node = closure() 19 | view.addSubview(node.view) 20 | return Relation(container: self, node: node) 21 | } 22 | } 23 | 24 | public extension Relation where Container == AbsoluteContainer { 25 | @discardableResult 26 | public func origin(_ origin: CGPoint) -> Relation { 27 | node.view.origin = origin 28 | return self 29 | } 30 | 31 | @discardableResult 32 | public func origin(_ origin: CGFloat) -> Relation { 33 | node.view.origin = CGPoint(x: origin, y: origin) 34 | return self 35 | } 36 | 37 | @discardableResult 38 | public func origin(_ x: CGFloat, _ y :CGFloat) -> Relation { 39 | node.view.origin = CGPoint(x: x, y: y) 40 | return self 41 | } 42 | 43 | @discardableResult 44 | public func x(_ x: CGFloat) -> Relation { 45 | node.view.x = x 46 | return self 47 | } 48 | 49 | @discardableResult 50 | public func y(_ y: CGFloat) -> Relation { 51 | node.view.y = y 52 | return self 53 | } 54 | 55 | @discardableResult 56 | public func center(_ center: CGPoint) -> Relation { 57 | node.view.center = center 58 | return self 59 | } 60 | 61 | @discardableResult 62 | public func center(_ center: CGFloat) -> Relation { 63 | node.view.center = CGPoint(x: center, y: center) 64 | return self 65 | } 66 | 67 | @discardableResult 68 | public func center(_ centerX: CGFloat, _ centerY: CGFloat) -> Relation { 69 | node.view.center = CGPoint(x: centerX, y: centerY) 70 | return self 71 | } 72 | 73 | @discardableResult 74 | public func centerX(_ centerX: CGFloat) -> Relation { 75 | node.view.centerX = centerX 76 | return self 77 | } 78 | 79 | @discardableResult 80 | public func centerY(_ centerY: CGFloat) -> Relation { 81 | node.view.centerY = centerY 82 | return self 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Mineral/Buildable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Makable.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 14/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Buildable { 12 | associatedtype Element 13 | 14 | init() 15 | func bind(viewModel: VM) -> Element 16 | } 17 | -------------------------------------------------------------------------------- /Mineral/Builder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Builder.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 14/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class Builder { 12 | public static func build(closure: (T) -> Void) -> T { 13 | let result = T() 14 | closure(result) 15 | return result 16 | } 17 | 18 | public static var build: T { 19 | return T() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Mineral/Button.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Button.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 26/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class Button: Node { 12 | var button: UIButton { 13 | get { 14 | return self.view as! UIButton 15 | } 16 | } 17 | 18 | public required init() { 19 | super.init() 20 | self.view = UIButton() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mineral/Container.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Container.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Container { 12 | associatedtype RelationType 13 | func build(closure: () -> Node) -> Relation 14 | } 15 | 16 | extension Container where Self: Node { 17 | @discardableResult 18 | public func color(_ color: UIColor, closure: (Self) -> ()) -> Self { 19 | view.backgroundColor = color 20 | closure(self) 21 | return self 22 | } 23 | 24 | @discardableResult 25 | public func size(_ size: CGSize, closure: (Self) -> ()) -> Self { 26 | view.size = size 27 | closure(self) 28 | return self 29 | } 30 | 31 | @discardableResult 32 | public func size(_ width: CGFloat, _ height: CGFloat, closure: (Self) -> ()) -> Self { 33 | view.size = CGSize(width: width, height: height) 34 | closure(self) 35 | return self 36 | } 37 | 38 | @discardableResult 39 | public func size(_ size: CGFloat, closure: (Self) -> ()) -> Self { 40 | view.size = CGSize(width: size, height: size) 41 | closure(self) 42 | return self 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Mineral/FlexContainer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FlexContainer.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 18/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import YogaKit 11 | 12 | public class FlexContainer: Node, Container { 13 | public override func bind(viewModel: VM) -> FlexContainer { 14 | return self 15 | } 16 | 17 | public func build(closure: () -> Node) -> Relation { 18 | let node = closure() 19 | view.addSubview(node.view) 20 | view.configureLayout { (layout) in 21 | layout.isEnabled = true 22 | } 23 | 24 | node.view.configureLayout { (layout) in 25 | layout.isEnabled = true 26 | layout.width = node.view.width 27 | layout.height = node.view.height 28 | } 29 | 30 | return Relation(container: self, node: node) 31 | } 32 | } 33 | 34 | public extension Relation where Container == FlexContainer { 35 | 36 | @discardableResult 37 | public func isIncludedInLayout(_ isIncludedInLayout: Bool) -> Relation { 38 | node.view.configureLayout { (layout) in 39 | layout.isIncludedInLayout = isIncludedInLayout 40 | } 41 | return self 42 | } 43 | 44 | @discardableResult 45 | public func isEnabled(_ isEnabled: Bool) -> Relation { 46 | node.view.configureLayout { (layout) in 47 | layout.isEnabled = isEnabled 48 | } 49 | return self 50 | } 51 | 52 | @discardableResult 53 | public func direction(_ direction: YGDirection) -> Relation { 54 | node.view.configureLayout { (layout) in 55 | layout.direction = direction 56 | } 57 | return self 58 | } 59 | 60 | @discardableResult 61 | public func flexDirection(_ flexDirection: YGFlexDirection) -> Relation { 62 | node.view.configureLayout { (layout) in 63 | layout.flexDirection = flexDirection 64 | } 65 | return self 66 | } 67 | 68 | @discardableResult 69 | public func justifyContent(_ justifyContent: YGJustify) -> Relation { 70 | node.view.configureLayout { (layout) in 71 | layout.justifyContent = justifyContent 72 | } 73 | return self 74 | } 75 | 76 | @discardableResult 77 | public func alignContent(_ alignContent: YGAlign) -> Relation { 78 | node.view.configureLayout { (layout) in 79 | layout.alignContent = alignContent 80 | } 81 | return self 82 | } 83 | 84 | @discardableResult 85 | public func alignItems(_ alignItems: YGAlign) -> Relation { 86 | node.view.configureLayout { (layout) in 87 | layout.alignItems = alignItems 88 | } 89 | return self 90 | } 91 | 92 | @discardableResult 93 | public func alignSelf(_ alignSelf: YGAlign) -> Relation { 94 | node.view.configureLayout { (layout) in 95 | layout.alignSelf = alignSelf 96 | } 97 | return self 98 | } 99 | 100 | @discardableResult 101 | public func position(_ position: YGPositionType) -> Relation { 102 | node.view.configureLayout { (layout) in 103 | layout.position = position 104 | } 105 | return self 106 | } 107 | 108 | @discardableResult 109 | public func flexWrap(_ flexWrap: YGWrap) -> Relation { 110 | node.view.configureLayout { (layout) in 111 | layout.flexWrap = flexWrap 112 | } 113 | return self 114 | } 115 | 116 | @discardableResult 117 | public func overflow(_ overflow: YGOverflow) -> Relation { 118 | node.view.configureLayout { (layout) in 119 | layout.overflow = overflow 120 | } 121 | return self 122 | } 123 | 124 | @discardableResult 125 | public func display(_ display: YGDisplay) -> Relation { 126 | node.view.configureLayout { (layout) in 127 | layout.display = display 128 | } 129 | return self 130 | } 131 | 132 | @discardableResult 133 | public func flexGrow(_ flexGrow: CGFloat) -> Relation { 134 | node.view.configureLayout { (layout) in 135 | layout.flexGrow = flexGrow 136 | } 137 | return self 138 | } 139 | 140 | @discardableResult 141 | public func flexShrink(_ flexShrink: CGFloat) -> Relation { 142 | node.view.configureLayout { (layout) in 143 | layout.flexShrink = flexShrink 144 | } 145 | return self 146 | } 147 | 148 | @discardableResult 149 | public func flexBasis(_ flexBasis: CGFloat) -> Relation { 150 | node.view.configureLayout { (layout) in 151 | layout.flexBasis = flexBasis 152 | } 153 | return self 154 | } 155 | 156 | @discardableResult 157 | public func left(_ left: CGFloat) -> Relation { 158 | node.view.configureLayout { (layout) in 159 | layout.left = left 160 | } 161 | return self 162 | } 163 | 164 | @discardableResult 165 | public func top(_ top: CGFloat) -> Relation { 166 | node.view.configureLayout { (layout) in 167 | layout.top = top 168 | } 169 | return self 170 | } 171 | 172 | @discardableResult 173 | public func right(_ right: CGFloat) -> Relation { 174 | node.view.configureLayout { (layout) in 175 | layout.right = right 176 | } 177 | return self 178 | } 179 | 180 | @discardableResult 181 | public func bottom(_ bottom: CGFloat) -> Relation { 182 | node.view.configureLayout { (layout) in 183 | layout.bottom = bottom 184 | } 185 | return self 186 | } 187 | 188 | @discardableResult 189 | public func start(_ start: CGFloat) -> Relation { 190 | node.view.configureLayout { (layout) in 191 | layout.start = start 192 | } 193 | return self 194 | } 195 | 196 | @discardableResult 197 | public func end(_ end: CGFloat) -> Relation { 198 | node.view.configureLayout { (layout) in 199 | layout.end = end 200 | } 201 | return self 202 | } 203 | 204 | @discardableResult 205 | public func marginLeft(_ marginLeft: CGFloat) -> Relation { 206 | node.view.configureLayout { (layout) in 207 | layout.marginLeft = marginLeft 208 | } 209 | return self 210 | } 211 | 212 | @discardableResult 213 | public func marginTop(_ marginTop: CGFloat) -> Relation { 214 | node.view.configureLayout { (layout) in 215 | layout.marginTop = marginTop 216 | } 217 | return self 218 | } 219 | 220 | @discardableResult 221 | public func marginRight(_ marginRight: CGFloat) -> Relation { 222 | node.view.configureLayout { (layout) in 223 | layout.marginRight = marginRight 224 | } 225 | return self 226 | } 227 | 228 | @discardableResult 229 | public func marginBottom(_ marginBottom: CGFloat) -> Relation { 230 | node.view.configureLayout { (layout) in 231 | layout.marginBottom = marginBottom 232 | } 233 | return self 234 | } 235 | 236 | @discardableResult 237 | public func marginStart(_ marginStart: CGFloat) -> Relation { 238 | node.view.configureLayout { (layout) in 239 | layout.marginStart = marginStart 240 | } 241 | return self 242 | } 243 | 244 | @discardableResult 245 | public func marginEnd(_ marginEnd: CGFloat) -> Relation { 246 | node.view.configureLayout { (layout) in 247 | layout.marginEnd = marginEnd 248 | } 249 | return self 250 | } 251 | 252 | @discardableResult 253 | public func marginHorizontal(_ marginHorizontal: CGFloat) -> Relation { 254 | node.view.configureLayout { (layout) in 255 | layout.marginHorizontal = marginHorizontal 256 | } 257 | return self 258 | } 259 | 260 | @discardableResult 261 | public func marginVertical(_ marginVertical: CGFloat) -> Relation { 262 | node.view.configureLayout { (layout) in 263 | layout.marginVertical = marginVertical 264 | } 265 | return self 266 | } 267 | 268 | @discardableResult 269 | public func margin(_ margin: CGFloat) -> Relation { 270 | node.view.configureLayout { (layout) in 271 | layout.margin = margin 272 | } 273 | return self 274 | } 275 | 276 | @discardableResult 277 | public func paddingLeft(_ paddingLeft: CGFloat) -> Relation { 278 | node.view.configureLayout { (layout) in 279 | layout.paddingLeft = paddingLeft 280 | } 281 | return self 282 | } 283 | 284 | @discardableResult 285 | public func paddingTop(_ paddingTop: CGFloat) -> Relation { 286 | node.view.configureLayout { (layout) in 287 | layout.paddingTop = paddingTop 288 | } 289 | return self 290 | } 291 | 292 | @discardableResult 293 | public func paddingRight(_ paddingRight: CGFloat) -> Relation { 294 | node.view.configureLayout { (layout) in 295 | layout.paddingRight = paddingRight 296 | } 297 | return self 298 | } 299 | 300 | @discardableResult 301 | public func paddingBottom(_ paddingBottom: CGFloat) -> Relation { 302 | node.view.configureLayout { (layout) in 303 | layout.paddingBottom = paddingBottom 304 | } 305 | return self 306 | } 307 | 308 | @discardableResult 309 | public func paddingStart(_ paddingStart: CGFloat) -> Relation { 310 | node.view.configureLayout { (layout) in 311 | layout.paddingStart = paddingStart 312 | } 313 | return self 314 | } 315 | 316 | @discardableResult 317 | public func paddingEnd(_ paddingEnd: CGFloat) -> Relation { 318 | node.view.configureLayout { (layout) in 319 | layout.paddingEnd = paddingEnd 320 | } 321 | return self 322 | } 323 | 324 | @discardableResult 325 | public func paddingHorizontal(_ paddingHorizontal: CGFloat) -> Relation { 326 | node.view.configureLayout { (layout) in 327 | layout.paddingHorizontal = paddingHorizontal 328 | } 329 | return self 330 | } 331 | 332 | @discardableResult 333 | public func paddingVertical(_ paddingVertical: CGFloat) -> Relation { 334 | node.view.configureLayout { (layout) in 335 | layout.paddingVertical = paddingVertical 336 | } 337 | return self 338 | } 339 | 340 | @discardableResult 341 | public func padding(_ padding: CGFloat) -> Relation { 342 | node.view.configureLayout { (layout) in 343 | layout.padding = padding 344 | } 345 | return self 346 | } 347 | 348 | @discardableResult 349 | public func borderLeftWidth(_ borderLeftWidth: CGFloat) -> Relation { 350 | node.view.configureLayout { (layout) in 351 | layout.borderLeftWidth = borderLeftWidth 352 | } 353 | return self 354 | } 355 | 356 | @discardableResult 357 | public func borderTopWidth(_ borderTopWidth: CGFloat) -> Relation { 358 | node.view.configureLayout { (layout) in 359 | layout.borderTopWidth = borderTopWidth 360 | } 361 | return self 362 | } 363 | 364 | @discardableResult 365 | public func borderRightWidth(_ borderRightWidth: CGFloat) -> Relation { 366 | node.view.configureLayout { (layout) in 367 | layout.borderRightWidth = borderRightWidth 368 | } 369 | return self 370 | } 371 | 372 | @discardableResult 373 | public func borderBottomWidth(_ borderBottomWidth: CGFloat) -> Relation { 374 | node.view.configureLayout { (layout) in 375 | layout.borderBottomWidth = borderBottomWidth 376 | } 377 | return self 378 | } 379 | 380 | @discardableResult 381 | public func borderStartWidth(_ borderStartWidth: CGFloat) -> Relation { 382 | node.view.configureLayout { (layout) in 383 | layout.borderStartWidth = borderStartWidth 384 | } 385 | return self 386 | } 387 | 388 | @discardableResult 389 | public func borderEndWidth(_ borderEndWidth: CGFloat) -> Relation { 390 | node.view.configureLayout { (layout) in 391 | layout.borderEndWidth = borderEndWidth 392 | } 393 | return self 394 | } 395 | 396 | @discardableResult 397 | public func borderWidth(_ borderWidth: CGFloat) -> Relation { 398 | node.view.configureLayout { (layout) in 399 | layout.borderWidth = borderWidth 400 | } 401 | return self 402 | } 403 | 404 | @discardableResult 405 | public func width(_ width: CGFloat) -> Relation { 406 | node.view.configureLayout { (layout) in 407 | layout.width = width 408 | } 409 | return self 410 | } 411 | 412 | @discardableResult 413 | public func height(_ height: CGFloat) -> Relation { 414 | node.view.configureLayout { (layout) in 415 | layout.height = height 416 | } 417 | return self 418 | } 419 | 420 | @discardableResult 421 | public func minWidth(_ minWidth: CGFloat) -> Relation { 422 | node.view.configureLayout { (layout) in 423 | layout.minWidth = minWidth 424 | } 425 | return self 426 | } 427 | 428 | @discardableResult 429 | public func minHeight(_ minHeight: CGFloat) -> Relation { 430 | node.view.configureLayout { (layout) in 431 | layout.minHeight = minHeight 432 | } 433 | return self 434 | } 435 | 436 | @discardableResult 437 | public func maxWidth(_ maxWidth: CGFloat) -> Relation { 438 | node.view.configureLayout { (layout) in 439 | layout.maxWidth = maxWidth 440 | } 441 | return self 442 | } 443 | 444 | @discardableResult 445 | public func maxHeight(_ maxHeight: CGFloat) -> Relation { 446 | node.view.configureLayout { (layout) in 447 | layout.maxHeight = maxHeight 448 | } 449 | return self 450 | } 451 | 452 | } 453 | -------------------------------------------------------------------------------- /Mineral/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Mineral/Mineral.h: -------------------------------------------------------------------------------- 1 | // 2 | // Mineral.h 3 | // Mineral 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Mineral. 12 | FOUNDATION_EXPORT double MineralVersionNumber; 13 | 14 | //! Project version string for Mineral. 15 | FOUNDATION_EXPORT const unsigned char MineralVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Mineral/Mineral.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mineral.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | -------------------------------------------------------------------------------- /Mineral/Node.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MNView.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 13/04/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class Node: Buildable { 12 | public required init() {} 13 | 14 | public func bind(viewModel: VM) -> Node { 15 | return self 16 | } 17 | 18 | public internal(set) var view: UIView = UIView() 19 | public let parent: Node? = nil 20 | 21 | @discardableResult 22 | public func color(_ color: UIColor) -> Self { 23 | view.backgroundColor = color 24 | return self 25 | } 26 | 27 | @discardableResult 28 | public func size(_ size: CGSize) -> Self { 29 | view.size = size 30 | return self 31 | } 32 | 33 | @discardableResult 34 | public func size(_ width: CGFloat, _ height: CGFloat) -> Self { 35 | view.size = CGSize(width: width, height: height) 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func size(_ size: CGFloat) -> Self { 41 | view.size = CGSize(width: size, height: size) 42 | return self 43 | } 44 | 45 | @discardableResult 46 | public func attachTo(_ container: T) -> Relation { 47 | return container.build { self } 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Mineral/Relation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Relation.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 11/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class Relation { 12 | public let container: Container 13 | public let node: Node 14 | 15 | public init(container: Container, node: Node) { 16 | self.container = container 17 | self.node = node 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mineral/RelativeContainer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RelativeContainer.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 11/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SnapKit 11 | 12 | public class RelativeContainer: Node, Container { 13 | public override func bind(viewModel: VM) -> RelativeContainer { 14 | return self 15 | } 16 | 17 | @discardableResult 18 | public func build(closure: () -> Node) -> Relation { 19 | let node = closure() 20 | view.addSubview(node.view) 21 | node.view.snp.makeConstraints { (make) in 22 | make.width.equalTo(node.view.width) 23 | make.height.equalTo(node.view.height) 24 | } 25 | return Relation(container: self, node: node) 26 | } 27 | } 28 | 29 | public extension Node { 30 | public var rlt: ConstraintViewDSL { 31 | return ConstraintViewDSL(view: self.view) 32 | } 33 | } 34 | 35 | public extension Relation where Container == RelativeContainer { 36 | @discardableResult 37 | public func left(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 38 | node.view.snp.makeConstraints { (make) in 39 | make.left.equalTo(other).offset(offset) 40 | } 41 | return self 42 | } 43 | 44 | @discardableResult 45 | public func right(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 46 | node.view.snp.makeConstraints { (make) in 47 | make.right.equalTo(other).offset(offset) 48 | } 49 | return self 50 | } 51 | 52 | @discardableResult 53 | public func top(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 54 | node.view.snp.makeConstraints { (make) in 55 | make.top.equalTo(other).offset(offset) 56 | } 57 | return self 58 | } 59 | 60 | @discardableResult 61 | public func bottom(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 62 | node.view.snp.makeConstraints { (make) in 63 | make.bottom.equalTo(other).offset(offset) 64 | } 65 | return self 66 | } 67 | 68 | @discardableResult 69 | public func centerX(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 70 | node.view.snp.makeConstraints { (make) in 71 | make.centerX.equalTo(other).offset(offset) 72 | } 73 | return self 74 | } 75 | 76 | @discardableResult 77 | public func centerY(_ other: ConstraintRelatableTarget, offset: ConstraintOffsetTarget = 0) -> Relation { 78 | node.view.snp.makeConstraints { (make) in 79 | make.centerY.equalTo(other).offset(offset) 80 | } 81 | return self 82 | } 83 | 84 | @discardableResult 85 | public func left(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 86 | return left(other.rlt.left, offset: offset) 87 | } 88 | 89 | @discardableResult 90 | public func right(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 91 | return right(other.rlt.right, offset: offset) 92 | } 93 | 94 | @discardableResult 95 | public func top(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 96 | return top(other.rlt.top, offset: offset) 97 | } 98 | 99 | @discardableResult 100 | public func bottom(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 101 | return bottom(other.rlt.bottom, offset: offset) 102 | } 103 | 104 | @discardableResult 105 | public func centerX(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 106 | return centerX(other.rlt.centerX, offset: offset) 107 | } 108 | 109 | @discardableResult 110 | public func centerY(_ other: Node, offset: ConstraintOffsetTarget = 0) -> Relation { 111 | return centerY(other.rlt.centerY, offset: offset) 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /Mineral/UIView+Measure.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Measure.swift 3 | // Mineral 4 | // 5 | // Created by draveness on 05/05/2017. 6 | // Copyright © 2017 draveness. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension UIView { 12 | var size: CGSize { 13 | get { 14 | return self.frame.size 15 | } 16 | set { 17 | var rect = self.frame 18 | rect.size = newValue 19 | self.frame = rect 20 | } 21 | } 22 | 23 | var width: CGFloat { 24 | get { 25 | return self.size.width 26 | } 27 | set { 28 | var size = self.size 29 | size.width = newValue 30 | self.size = size 31 | } 32 | } 33 | 34 | var height: CGFloat { 35 | get { 36 | return self.size.height 37 | } 38 | set { 39 | var size = self.size 40 | size.height = newValue 41 | self.size = size 42 | } 43 | } 44 | 45 | var origin: CGPoint { 46 | get { 47 | return self.frame.origin 48 | } 49 | set { 50 | var rect = self.frame 51 | rect.origin = newValue 52 | self.frame = rect 53 | } 54 | } 55 | 56 | var x: CGFloat { 57 | get { 58 | return self.frame.origin.x 59 | } 60 | set { 61 | var rect = self.frame 62 | rect.origin.x = newValue 63 | self.frame = rect 64 | } 65 | } 66 | 67 | var y: CGFloat { 68 | get { 69 | return self.frame.origin.y 70 | } 71 | set { 72 | var rect = self.frame 73 | rect.origin.y = newValue 74 | self.frame = rect 75 | } 76 | } 77 | 78 | var centerX: CGFloat { 79 | get { 80 | return self.center.x 81 | } 82 | set { 83 | var center = self.center 84 | center.x = newValue 85 | self.center = center 86 | } 87 | } 88 | 89 | var centerY: CGFloat { 90 | get { 91 | return self.center.y 92 | } 93 | set { 94 | var center = self.center 95 | center.y = newValue 96 | self.center = center 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Mineral' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for Mineral 9 | 10 | pod 'SnapKit', :git => 'git@github.com:Draveness/SnapKit.git' 11 | pod 'RbSwift' 12 | pod 'YogaKit' 13 | end 14 | 15 | target 'Mineral Demo' do 16 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 17 | use_frameworks! 18 | 19 | # Pods for Mineral Demo 20 | 21 | end 22 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RbSwift (0.4.0) 3 | - SnapKit (3.2.0) 4 | - Yoga (1.3.0) 5 | - YogaKit (1.3.0): 6 | - Yoga (~> 1.3) 7 | 8 | DEPENDENCIES: 9 | - RbSwift 10 | - SnapKit (from `git@github.com:Draveness/SnapKit.git`) 11 | - YogaKit 12 | 13 | EXTERNAL SOURCES: 14 | SnapKit: 15 | :git: git@github.com:Draveness/SnapKit.git 16 | 17 | CHECKOUT OPTIONS: 18 | SnapKit: 19 | :commit: 4540d536b74c67fffb0e7cb6686f60afa167ce6d 20 | :git: git@github.com:Draveness/SnapKit.git 21 | 22 | SPEC CHECKSUMS: 23 | RbSwift: 3581b748954330aed97863c0aa04ab17fa0d4b6d 24 | SnapKit: c71c530b73cedd2a8b998098687001baff265086 25 | Yoga: 2ed1d7accfef3610a67f58c0cf101a0662137f2c 26 | YogaKit: cddeccc6a8d2aff563e4c738d3bddb290a6de4cb 27 | 28 | PODFILE CHECKSUM: d8cddd4ef720196c1354b12fe78a8e9baeaf621f 29 | 30 | COCOAPODS: 1.2.1 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mineral 2 | 3 | A library used to separate concerns from the original UIKit framework. 4 | 5 | http://draveness.me/mvx-view.html 6 | 7 | ## Node 8 | 9 | ```swift 10 | public class Node: Buildable { 11 | public internal(set) var view: UIView = UIView() 12 | 13 | @discardableResult 14 | public func size(_ size: CGSize) -> Element { 15 | view.size = size 16 | return self 17 | } 18 | } 19 | ``` 20 | 21 | ## Container 22 | 23 | An abstract protocol 24 | 25 | ```swift 26 | public protocol Container { 27 | associatedtype RelationType 28 | func build(closure: () -> Node) -> Relation 29 | } 30 | ``` 31 | 32 | ### AbsoluteContainer 33 | 34 | ```swift 35 | let frame = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) 36 | Builder.build.color(UIColor.white).size(50) 37 | .attachTo(frame).origin(10) 38 | Builder.build.color(UIColor.red).size(50) 39 | .attachTo(frame).center(200, 300) 40 | ``` 41 | 42 | ### RelativeContainer 43 | 44 | ```swift 45 | let constraint = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) 46 | 47 | let node = Builder.build.color(UIColor.white).size(50) 48 | .attachTo(constraint) 49 | .left(constraint) 50 | .top(constraint, offset: 20).node 51 | 52 | Builder.build.color(UIColor.red).size(50) 53 | .attachTo(constraint) 54 | .left(node.rlt.right) 55 | .centerY(node) 56 | ``` 57 | 58 | ### FlexContainer 59 | 60 | ```swift 61 | let flexbox = Builder.build.color(UIColor.lightGray).size(self.view.frame.size) { container in 62 | Builder.build 63 | .color(UIColor.white) 64 | .size(100) 65 | .attachTo(container) 66 | Builder.build.color(UIColor.red).size(100).attachTo(container) 67 | } 68 | 69 | view.addSubview(flexbox.view) 70 | ``` 71 | 72 | 73 | --------------------------------------------------------------------------------