├── .gitignore ├── Images └── logo-1024-300.png ├── LICENSE ├── README.md ├── Source ├── Engine │ ├── ViewStyle.swift │ ├── ViewStyleAttribute.swift │ ├── ViewStyleAttributeExtensionSupport.swift │ ├── ViewStyleAttributeHandler.swift │ ├── ViewStyleBuilder.swift │ ├── ViewStyleExtensionSupport.swift │ └── ViewStyleManager.swift └── Extensions │ └── UIViewExtensionStyleKit.swift ├── StyleKit ├── StyleKit.xcworkspace │ └── contents.xcworkspacedata ├── StyleKit │ ├── StyleKit.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── StyleKit │ │ ├── Info.plist │ │ └── StyleKit.h └── StyleKitDemo │ ├── StyleKitDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── StyleKitDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── Styles │ └── StyleStorage.swift │ └── ViewControllers │ └── Main │ ├── MainViewController.swift │ └── MainViewController.xib └── UIStyle.podspec /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | 4 | .* 5 | !/.gitignore 6 | 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # CocoaPods 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Pods/ 31 | 32 | # Carthage 33 | # 34 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 35 | # Carthage/Checkouts 36 | 37 | Carthage/Build 38 | -------------------------------------------------------------------------------- /Images/logo-1024-300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simplisticated/StyleKit/d6ccca9ea2c617595ce52f59a6b78d3643d6d683/Images/logo-1024-300.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Igor Matyushkin 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | StyleKit 3 |

4 | 5 |

6 | 7 | 8 | 9 | 10 |

11 | 12 | # At a Glance 13 | 14 | Front-end developers, who create layout for HTML pages, know the simplicity and power of CSS classes. At some point I thought: why not to make something similar for native iOS apps? This idea was quite obvious. When the first version of the framework has been done, it was named `StyleKit`. Obvious name for obvious thing. 15 | 16 | # How To Get Started 17 | 18 | - Copy content of `Source` folder to your project. 19 | 20 | or 21 | 22 | - Use `UIStyle` cocoapod 23 | 24 | # Requirements 25 | 26 | * iOS 9.0 and later 27 | * Xcode 8 and later 28 | 29 | # Usage 30 | 31 | Style is a set of UI attributes. Each style includes at least one attribute, but can include unlimited collection of attributes. 32 | 33 | ```swift 34 | /* 35 | * Create simple style with one attribute. 36 | */ 37 | let attributes: [ViewStyleAttribute] = [ 38 | .backgroundColor(color: .yellow) 39 | ] 40 | 41 | let yellowBackground = ViewStyle(attributes: attributes) 42 | 43 | /* 44 | * Another way to create the same style. 45 | */ 46 | 47 | let anotherYellowBackground = ViewStyle.with(attribute: .backgroundColor(color: .yellow)) 48 | .done() 49 | 50 | /* 51 | * Create style with multiple attributes. 52 | */ 53 | 54 | let greenBackgroundWithThinRedBorder = ViewStyle.with(attribute: .backgroundColor(color: .green)) 55 | .and(attribute: .borderColor(color: .red)) 56 | .and(attribute: .borderWidth(width: 1.0)) 57 | .done() 58 | ``` 59 | 60 | Full list of attributes is available in [ViewStyleAttribute.swift](https://github.com/igormatyushkin014/StyleKit/blob/master/Source/Engine/ViewStyleAttribute.swift) file. 61 | 62 | Any style can be applied to any view. You can apply unlimited number of styles to the same view. 63 | 64 | ```swift 65 | /* 66 | * Apply style to view. 67 | */ 68 | 69 | view.stl.apply(style: yellowBackground) 70 | 71 | /* 72 | * Apply multiple styles to view. 73 | */ 74 | 75 | view.stl.apply(style: yellowBackground) 76 | .apply(style: greenBackgroundWithThinRedBorder) 77 | ``` 78 | 79 | Recommended way to manage styles in app is to implement a structure with static styles: 80 | 81 | ```swift 82 | struct StyleStorage { 83 | 84 | static let defaultBackground = ViewStyle.with(attribute: .backgroundColor(color: .white)) 85 | .and(attribute: .borderColor(color: .green)) 86 | .and(attribute: .borderWidth(width: 2.0)) 87 | .done() 88 | 89 | static let thinOrangeText = ViewStyle.with(attribute: .textColor(color: .orange)) 90 | .and(attribute: .font(font: UIFont.systemFont(ofSize: 36.0, weight: UIFontWeightThin))) 91 | .done() 92 | 93 | } 94 | ``` 95 | 96 | Those styles can be reused many times in different places of the app: 97 | 98 | ```swift 99 | override func viewDidLoad() { 100 | super.viewDidLoad() 101 | 102 | /* 103 | * Initialize view. 104 | */ 105 | 106 | view.stl.apply(style: StyleStorage.defaultBackground) 107 | 108 | /* 109 | * Initialize title label. 110 | */ 111 | 112 | titleLabel.stl.apply(style: StyleStorage.thinOrangeText) 113 | } 114 | ``` 115 | 116 | Also, it's possible to check programmatically if style supports view: 117 | 118 | ```swift 119 | if StyleStorage.thinOrangeText.supports(view: helloLabel) { 120 | helloLabel.stl.apply(style: StyleStorage.thinOrangeText) 121 | } 122 | ``` 123 | 124 | # License 125 | 126 | `StyleKit` is available under the MIT license. See the [LICENSE](./LICENSE) file for more info. 127 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyle.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** 12 | * Represents view style which is a set of attributes. 13 | */ 14 | public class ViewStyle: NSObject { 15 | 16 | // MARK: Class variables & properties 17 | 18 | // MARK: Public class methods 19 | 20 | public class func with(attribute: ViewStyleAttribute) -> ViewStyleBuilder { 21 | let attributes = [ 22 | attribute 23 | ] 24 | 25 | return ViewStyleBuilder(attributes: attributes) 26 | } 27 | 28 | // MARK: Private class methods 29 | 30 | // MARK: Initializers 31 | 32 | public init(attributes: [ViewStyleAttribute]) { 33 | super.init() 34 | 35 | /** 36 | * Initialize attributes collection. 37 | */ 38 | 39 | _attributes = [ViewStyleAttribute]() 40 | _attributes.append(contentsOf: attributes) 41 | } 42 | 43 | // MARK: Deinitializer 44 | 45 | deinit { 46 | /** 47 | * Remove references. 48 | */ 49 | 50 | _attributes = nil 51 | } 52 | 53 | // MARK: Object variables & properties 54 | 55 | fileprivate var _attributes: [ViewStyleAttribute]! 56 | 57 | /** 58 | * Collection of attributes, included in current style. 59 | */ 60 | public var attributes: [ViewStyleAttribute] { 61 | get { 62 | return _attributes 63 | } 64 | } 65 | 66 | // MARK: Public object methods 67 | 68 | // MARK: Private object methods 69 | 70 | // MARK: Protocol methods 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleAttribute.swift: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ViewStyleAttribute.swift 4 | // StyleKit 5 | // 6 | // Created by Igor Matyushkin on 23.11.16. 7 | // Copyright © 2016 Visuality. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | import UIKit 12 | 13 | /** 14 | * Attribute of UI style. 15 | */ 16 | public enum ViewStyleAttribute { 17 | /** 18 | * Works with `UIView` instance. 19 | */ 20 | case backgroundColor(color: UIColor) 21 | 22 | /** 23 | * Works with `UIView` instance. 24 | */ 25 | case borderColor(color: UIColor) 26 | 27 | /** 28 | * Works with `UIView` instance. 29 | */ 30 | case borderWidth(width: CGFloat) 31 | 32 | /** 33 | * Works with `UIView` instance. 34 | */ 35 | case cornerRadius(radius: CGFloat) 36 | 37 | /** 38 | * Works with `UIView` instance. 39 | */ 40 | case frame(frame: CGRect) 41 | 42 | /** 43 | * Works with `UIView` instance. 44 | */ 45 | case size(size: CGSize) 46 | 47 | /** 48 | * Works with `UILabel` and `UITextView`. 49 | */ 50 | case textColor(color: UIColor) 51 | 52 | /** 53 | * Works with `UIButton`. 54 | */ 55 | case buttonTitleColor(titleColor: UIColor, controlState: UIControlState) 56 | 57 | /** 58 | * Works with `UILabel`, `UITextView` and `UIButton`. 59 | */ 60 | case font(font: UIFont) 61 | 62 | /** 63 | * Works with `UILabel` and `UITextView`. 64 | */ 65 | case textAlignment(alignment: NSTextAlignment) 66 | 67 | /** 68 | * Works with `UIControl`. 69 | */ 70 | case contentHorizontalAlignment(alignment: UIControlContentHorizontalAlignment) 71 | 72 | /** 73 | * Works with `UIControl`. 74 | */ 75 | case contentVerticalAlignment(alignment: UIControlContentVerticalAlignment) 76 | 77 | /** 78 | * Works with `UIControl`. 79 | */ 80 | case tintColor(color: UIColor) 81 | 82 | /** 83 | * Works with `UIImageView`. 84 | */ 85 | case image(image: UIImage, contentMode: UIViewContentMode) 86 | } 87 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleAttributeExtensionSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyleAttributeExtensionSupport.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 29.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public extension ViewStyleAttribute { 12 | 13 | /** 14 | Returns `true` if specified view is supported by current attribute. 15 | Otherwise, returns `false`. 16 | */ 17 | public func supports(view: UIView) -> Bool { 18 | switch self { 19 | case .backgroundColor(_): 20 | return true 21 | case .borderColor(_): 22 | return true 23 | case .borderWidth(_): 24 | return true 25 | case .cornerRadius(_): 26 | return true 27 | case .frame(_): 28 | return true 29 | case .size(_): 30 | return true 31 | case .textColor(_): 32 | return view is UILabel 33 | || view is UITextView 34 | case .buttonTitleColor(_): 35 | return view is UIButton 36 | case .font(_): 37 | return view is UILabel 38 | || view is UITextView 39 | case .textAlignment(_): 40 | return view is UILabel 41 | || view is UITextView 42 | case .contentHorizontalAlignment(_): 43 | return view is UIControl 44 | case .contentVerticalAlignment(_): 45 | return view is UIControl 46 | case .tintColor(_): 47 | return view is UIControl 48 | case .image(_, _): 49 | return view is UIImageView 50 | default: 51 | return false 52 | } 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleAttributeHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyleAttributeHandler.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 26.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** 12 | * Applies attributes to views. 13 | */ 14 | internal class ViewStyleAttributeHandler: NSObject { 15 | 16 | // MARK: Class variables & properties 17 | 18 | // MARK: Public class methods 19 | 20 | // MARK: Private class methods 21 | 22 | // MARK: Initializers 23 | 24 | public override init() { 25 | super.init() 26 | } 27 | 28 | // MARK: Deinitializer 29 | 30 | deinit { 31 | } 32 | 33 | // MARK: Object variables & properties 34 | 35 | // MARK: Public object methods 36 | 37 | /** 38 | * Applies attribute to view. 39 | */ 40 | public func apply(attribute: ViewStyleAttribute, toView view: UIView) { 41 | /** 42 | * Check attribute value. 43 | */ 44 | 45 | switch attribute { 46 | case let .backgroundColor(color): 47 | /** 48 | * Update view's background color. 49 | */ 50 | 51 | view.backgroundColor = color 52 | break 53 | case let .borderColor(color): 54 | /** 55 | * Update view's border color. 56 | */ 57 | 58 | view.layer.borderColor = color.cgColor 59 | break 60 | case let .borderWidth(width): 61 | /** 62 | * Update view's border width. 63 | */ 64 | 65 | view.layer.borderWidth = width 66 | break 67 | case let .cornerRadius(radius): 68 | /** 69 | * Update view's corner radius. 70 | */ 71 | 72 | view.layer.cornerRadius = radius 73 | break 74 | case let .frame(frame): 75 | /** 76 | * Update view's frame. 77 | */ 78 | 79 | view.frame = frame 80 | break 81 | case let .size(size): 82 | /** 83 | * Update view's size. 84 | */ 85 | 86 | view.frame = CGRect(origin: view.frame.origin, size: size) 87 | break 88 | case let .textColor(color): 89 | /** 90 | * Check view's type. 91 | */ 92 | 93 | if view is UILabel { 94 | /** 95 | * Update text color of `UILabel` instance. 96 | */ 97 | 98 | let label = view as! UILabel 99 | label.textColor = color 100 | } else if view is UITextView { 101 | /** 102 | * Update text color of `UITextView` instance. 103 | */ 104 | 105 | let textView = view as! UITextView 106 | textView.textColor = color 107 | } else if view is UIButton { 108 | /** 109 | * Update text color of `UIButton` instance. 110 | */ 111 | 112 | let button = view as! UIButton 113 | button.setTitleColor(color, for: .normal) 114 | } else { 115 | /** 116 | * View's type is not supported by current attribute. 117 | * Therefore, do nothing. 118 | */ 119 | } 120 | break 121 | case let .buttonTitleColor(titleColor, controlState): 122 | /** 123 | * Check view's type. 124 | */ 125 | 126 | if view is UIButton { 127 | /** 128 | * Update text color of `UIButton` instance. 129 | */ 130 | 131 | let button = view as! UIButton 132 | button.setTitleColor(titleColor, for: controlState) 133 | } else { 134 | /** 135 | * View's type is not supported by current attribute. 136 | * Therefore, do nothing. 137 | */ 138 | } 139 | break 140 | case let .font(font): 141 | /** 142 | * Check view's type. 143 | */ 144 | 145 | if view is UILabel { 146 | /** 147 | * Update font of `UILabel` instance. 148 | */ 149 | 150 | let label = view as! UILabel 151 | label.font = font 152 | } else if view is UITextView { 153 | /** 154 | * Update font of `UITextView` instance. 155 | */ 156 | 157 | let textView = view as! UITextView 158 | textView.font = font 159 | } else if view is UIButton { 160 | /** 161 | * Update font of `UIButton` instance. 162 | */ 163 | 164 | let button = view as! UIButton 165 | button.titleLabel?.font = font 166 | } else { 167 | /** 168 | * View's type is not supported by current attribute. 169 | * Therefore, do nothing. 170 | */ 171 | } 172 | break 173 | case let .textAlignment(alignment): 174 | /** 175 | * Check view's type. 176 | */ 177 | 178 | if view is UILabel { 179 | /** 180 | * Update text alignment of `UILabel` instance. 181 | */ 182 | 183 | let label = view as! UILabel 184 | label.textAlignment = alignment 185 | } else if view is UITextView { 186 | /** 187 | * Update text alignment of `UITextView` instance. 188 | */ 189 | 190 | let textView = view as! UITextView 191 | textView.textAlignment = alignment 192 | } else { 193 | /** 194 | * View's type is not supported by current attribute. 195 | * Therefore, do nothing. 196 | */ 197 | } 198 | break 199 | case let .contentHorizontalAlignment(alignment): 200 | /** 201 | * Check view's type. 202 | */ 203 | 204 | if view is UIControl { 205 | /** 206 | * Update content horizontal alignment of `UIButton` instance. 207 | */ 208 | 209 | let control = view as! UIControl 210 | control.contentHorizontalAlignment = alignment 211 | } else { 212 | /** 213 | * View's type is not supported by current attribute. 214 | * Therefore, do nothing. 215 | */ 216 | } 217 | break 218 | case let .contentVerticalAlignment(alignment): 219 | /** 220 | * Check view's type. 221 | */ 222 | 223 | if view is UIControl { 224 | /** 225 | * Update content horizontal alignment of `UIButton` instance. 226 | */ 227 | 228 | let control = view as! UIControl 229 | control.contentVerticalAlignment = alignment 230 | } else { 231 | /** 232 | * View's type is not supported by current attribute. 233 | * Therefore, do nothing. 234 | */ 235 | } 236 | break 237 | case let .tintColor(color): 238 | /** 239 | * Check view's type. 240 | */ 241 | 242 | if view is UIControl { 243 | /** 244 | * Update tint color of `UIButton` instance. 245 | */ 246 | 247 | let control = view as! UIControl 248 | control.tintColor = color 249 | } else { 250 | /** 251 | * View's type is not supported by current attribute. 252 | * Therefore, do nothing. 253 | */ 254 | } 255 | break 256 | case let .image(image, contentMode): 257 | /** 258 | * Check view's type. 259 | */ 260 | 261 | if view is UIImageView { 262 | /** 263 | * Update image and content mode of `UIImageView` instance. 264 | */ 265 | 266 | let imageView = view as! UIImageView 267 | imageView.image = image 268 | imageView.contentMode = contentMode 269 | } else { 270 | /** 271 | * View's type is not supported by current attribute. 272 | * Therefore, do nothing. 273 | */ 274 | } 275 | break 276 | default: 277 | /** 278 | * Attribute's value was not recognized. 279 | * Therefore, do nothing. 280 | */ 281 | break 282 | } 283 | } 284 | 285 | // MARK: Private object methods 286 | 287 | // MARK: Protocol methods 288 | 289 | } 290 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyleBuilder.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** 12 | * Builder for `ViewStyle` instance. 13 | */ 14 | public class ViewStyleBuilder: NSObject { 15 | 16 | // MARK: Class variables & properties 17 | 18 | // MARK: Public class methods 19 | 20 | // MARK: Private class methods 21 | 22 | // MARK: Initializers 23 | 24 | internal init(attributes: [ViewStyleAttribute]) { 25 | super.init() 26 | 27 | /** 28 | * Initialize attributes collection. 29 | */ 30 | 31 | self.attributes = [ViewStyleAttribute]() 32 | self.attributes.append(contentsOf: attributes) 33 | } 34 | 35 | // MARK: Deinitializer 36 | 37 | deinit { 38 | /** 39 | * Remove references. 40 | */ 41 | 42 | attributes = nil 43 | } 44 | 45 | // MARK: Object variables & properties 46 | 47 | fileprivate var attributes: [ViewStyleAttribute]! 48 | 49 | // MARK: Public object methods 50 | 51 | public func and(attribute: ViewStyleAttribute) -> ViewStyleBuilder { 52 | /** 53 | * Append attribute to collection. 54 | */ 55 | 56 | attributes.append(attribute) 57 | 58 | /** 59 | * Return reference to current instance of `ViewStyleBuilder` class 60 | * to support call chains. 61 | */ 62 | 63 | return self 64 | } 65 | 66 | public func done() -> ViewStyle { 67 | /** 68 | * Return style filled with attributes from 69 | * current builder's collection. 70 | */ 71 | 72 | return ViewStyle(attributes: attributes) 73 | } 74 | 75 | // MARK: Private object methods 76 | 77 | // MARK: Protocol methods 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleExtensionSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyleExtensionSupport.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 29.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public extension ViewStyle { 12 | 13 | /** 14 | Returns `true` if all attributes support specified view. 15 | In case when at least one attribute doesn't support speficied view, returns `false`. 16 | */ 17 | public func supports(view: UIView) -> Bool { 18 | for attribute in attributes { 19 | if !attribute.supports(view: view) { 20 | return false 21 | } 22 | } 23 | 24 | return true 25 | } 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Source/Engine/ViewStyleManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewStyleManager.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** 12 | * Applies styles to view. 13 | */ 14 | public class ViewStyleManager: NSObject { 15 | 16 | // MARK: Class variables & properties 17 | 18 | // MARK: Public class methods 19 | 20 | // MARK: Private class methods 21 | 22 | // MARK: Initializers 23 | 24 | public init(forView view: UIView) { 25 | super.init() 26 | 27 | /** 28 | * Initialize associated view. 29 | */ 30 | 31 | _associatedView = view 32 | } 33 | 34 | // MARK: Deinitializer 35 | 36 | deinit { 37 | /** 38 | * Remove references. 39 | */ 40 | 41 | _associatedView = nil 42 | } 43 | 44 | // MARK: Object variables & properties 45 | 46 | fileprivate var _associatedView: UIView! 47 | 48 | /** 49 | * The view that is managed by current instance 50 | * of `ViewStyleManager` class. 51 | */ 52 | public var associatedView: UIView { 53 | get { 54 | return _associatedView 55 | } 56 | } 57 | 58 | // MARK: Public object methods 59 | 60 | /** 61 | * Applies style to associated view. 62 | */ 63 | @discardableResult 64 | public func apply(style: ViewStyle) -> ViewStyleManager { 65 | /** 66 | * Create view style attribute handler. 67 | */ 68 | 69 | let viewStyleAttributeHandler = ViewStyleAttributeHandler() 70 | 71 | /** 72 | * Apply all attributes included in style to associated view. 73 | */ 74 | 75 | for attribute in style.attributes { 76 | viewStyleAttributeHandler.apply(attribute: attribute, toView: associatedView) 77 | } 78 | 79 | /** 80 | * Return reference to current `ViewStyleManager` instance 81 | * to support call chains. 82 | */ 83 | 84 | return self 85 | } 86 | 87 | // MARK: Private object methods 88 | 89 | // MARK: Protocol methods 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Source/Extensions/UIViewExtensionStyleKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewExtensionStyleKit.swift 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public extension UIView { 13 | 14 | /** 15 | * `ViewStyleManager` instance, associated with current view. 16 | */ 17 | var stl: ViewStyleManager { 18 | get { 19 | return ViewStyleManager(forView: self) 20 | } 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /StyleKit/StyleKit.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /StyleKit/StyleKit/StyleKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 69517C121DE62D1D00C4DFB5 /* StyleKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 69517C101DE62D1D00C4DFB5 /* StyleKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 69517C611DE6318E00C4DFB5 /* ViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69517C5B1DE6318E00C4DFB5 /* ViewStyle.swift */; }; 12 | 69517C621DE6318E00C4DFB5 /* ViewStyleAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69517C5C1DE6318E00C4DFB5 /* ViewStyleAttribute.swift */; }; 13 | 69517C631DE6318E00C4DFB5 /* ViewStyleBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69517C5D1DE6318E00C4DFB5 /* ViewStyleBuilder.swift */; }; 14 | 69517C641DE6318E00C4DFB5 /* ViewStyleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69517C5E1DE6318E00C4DFB5 /* ViewStyleManager.swift */; }; 15 | 69517C651DE6318E00C4DFB5 /* UIViewExtensionStyleKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69517C601DE6318E00C4DFB5 /* UIViewExtensionStyleKit.swift */; }; 16 | 69B456C51DE90A3C006BCB8D /* ViewStyleAttributeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69B456C41DE90A3C006BCB8D /* ViewStyleAttributeHandler.swift */; }; 17 | 69DC76691DED064B00E4CEDD /* ViewStyleAttributeExtensionSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69DC76681DED064B00E4CEDD /* ViewStyleAttributeExtensionSupport.swift */; }; 18 | 69DC766B1DED07CF00E4CEDD /* ViewStyleExtensionSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69DC766A1DED07CF00E4CEDD /* ViewStyleExtensionSupport.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 69517C0D1DE62D1D00C4DFB5 /* StyleKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StyleKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 69517C101DE62D1D00C4DFB5 /* StyleKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleKit.h; sourceTree = ""; }; 24 | 69517C111DE62D1D00C4DFB5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 69517C5B1DE6318E00C4DFB5 /* ViewStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyle.swift; sourceTree = ""; }; 26 | 69517C5C1DE6318E00C4DFB5 /* ViewStyleAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleAttribute.swift; sourceTree = ""; }; 27 | 69517C5D1DE6318E00C4DFB5 /* ViewStyleBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleBuilder.swift; sourceTree = ""; }; 28 | 69517C5E1DE6318E00C4DFB5 /* ViewStyleManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleManager.swift; sourceTree = ""; }; 29 | 69517C601DE6318E00C4DFB5 /* UIViewExtensionStyleKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewExtensionStyleKit.swift; sourceTree = ""; }; 30 | 69B456C41DE90A3C006BCB8D /* ViewStyleAttributeHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleAttributeHandler.swift; sourceTree = ""; }; 31 | 69DC76681DED064B00E4CEDD /* ViewStyleAttributeExtensionSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleAttributeExtensionSupport.swift; sourceTree = ""; }; 32 | 69DC766A1DED07CF00E4CEDD /* ViewStyleExtensionSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewStyleExtensionSupport.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 69517C091DE62D1D00C4DFB5 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 69517C031DE62D1D00C4DFB5 = { 47 | isa = PBXGroup; 48 | children = ( 49 | 69517C0F1DE62D1D00C4DFB5 /* StyleKit */, 50 | 69517C0E1DE62D1D00C4DFB5 /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | 69517C0E1DE62D1D00C4DFB5 /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 69517C0D1DE62D1D00C4DFB5 /* StyleKit.framework */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 69517C0F1DE62D1D00C4DFB5 /* StyleKit */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 69517C591DE6318E00C4DFB5 /* Source */, 66 | 69517C101DE62D1D00C4DFB5 /* StyleKit.h */, 67 | 69517C111DE62D1D00C4DFB5 /* Info.plist */, 68 | ); 69 | path = StyleKit; 70 | sourceTree = ""; 71 | }; 72 | 69517C591DE6318E00C4DFB5 /* Source */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 69517C5A1DE6318E00C4DFB5 /* Engine */, 76 | 69517C5F1DE6318E00C4DFB5 /* Extensions */, 77 | ); 78 | name = Source; 79 | path = ../../../Source; 80 | sourceTree = ""; 81 | }; 82 | 69517C5A1DE6318E00C4DFB5 /* Engine */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 69517C5C1DE6318E00C4DFB5 /* ViewStyleAttribute.swift */, 86 | 69DC76681DED064B00E4CEDD /* ViewStyleAttributeExtensionSupport.swift */, 87 | 69517C5B1DE6318E00C4DFB5 /* ViewStyle.swift */, 88 | 69DC766A1DED07CF00E4CEDD /* ViewStyleExtensionSupport.swift */, 89 | 69517C5D1DE6318E00C4DFB5 /* ViewStyleBuilder.swift */, 90 | 69B456C41DE90A3C006BCB8D /* ViewStyleAttributeHandler.swift */, 91 | 69517C5E1DE6318E00C4DFB5 /* ViewStyleManager.swift */, 92 | ); 93 | path = Engine; 94 | sourceTree = ""; 95 | }; 96 | 69517C5F1DE6318E00C4DFB5 /* Extensions */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 69517C601DE6318E00C4DFB5 /* UIViewExtensionStyleKit.swift */, 100 | ); 101 | path = Extensions; 102 | sourceTree = ""; 103 | }; 104 | /* End PBXGroup section */ 105 | 106 | /* Begin PBXHeadersBuildPhase section */ 107 | 69517C0A1DE62D1D00C4DFB5 /* Headers */ = { 108 | isa = PBXHeadersBuildPhase; 109 | buildActionMask = 2147483647; 110 | files = ( 111 | 69517C121DE62D1D00C4DFB5 /* StyleKit.h in Headers */, 112 | ); 113 | runOnlyForDeploymentPostprocessing = 0; 114 | }; 115 | /* End PBXHeadersBuildPhase section */ 116 | 117 | /* Begin PBXNativeTarget section */ 118 | 69517C0C1DE62D1D00C4DFB5 /* StyleKit */ = { 119 | isa = PBXNativeTarget; 120 | buildConfigurationList = 69517C151DE62D1D00C4DFB5 /* Build configuration list for PBXNativeTarget "StyleKit" */; 121 | buildPhases = ( 122 | 69517C081DE62D1D00C4DFB5 /* Sources */, 123 | 69517C091DE62D1D00C4DFB5 /* Frameworks */, 124 | 69517C0A1DE62D1D00C4DFB5 /* Headers */, 125 | 69517C0B1DE62D1D00C4DFB5 /* Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = StyleKit; 132 | productName = StyleKit; 133 | productReference = 69517C0D1DE62D1D00C4DFB5 /* StyleKit.framework */; 134 | productType = "com.apple.product-type.framework"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | 69517C041DE62D1D00C4DFB5 /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | LastUpgradeCheck = 0810; 143 | ORGANIZATIONNAME = Visuality; 144 | TargetAttributes = { 145 | 69517C0C1DE62D1D00C4DFB5 = { 146 | CreatedOnToolsVersion = 8.1; 147 | DevelopmentTeam = AFEG59EG8E; 148 | ProvisioningStyle = Automatic; 149 | }; 150 | }; 151 | }; 152 | buildConfigurationList = 69517C071DE62D1D00C4DFB5 /* Build configuration list for PBXProject "StyleKit" */; 153 | compatibilityVersion = "Xcode 3.2"; 154 | developmentRegion = English; 155 | hasScannedForEncodings = 0; 156 | knownRegions = ( 157 | en, 158 | ); 159 | mainGroup = 69517C031DE62D1D00C4DFB5; 160 | productRefGroup = 69517C0E1DE62D1D00C4DFB5 /* Products */; 161 | projectDirPath = ""; 162 | projectRoot = ""; 163 | targets = ( 164 | 69517C0C1DE62D1D00C4DFB5 /* StyleKit */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | 69517C0B1DE62D1D00C4DFB5 /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXSourcesBuildPhase section */ 180 | 69517C081DE62D1D00C4DFB5 /* Sources */ = { 181 | isa = PBXSourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 69DC766B1DED07CF00E4CEDD /* ViewStyleExtensionSupport.swift in Sources */, 185 | 69517C651DE6318E00C4DFB5 /* UIViewExtensionStyleKit.swift in Sources */, 186 | 69B456C51DE90A3C006BCB8D /* ViewStyleAttributeHandler.swift in Sources */, 187 | 69517C641DE6318E00C4DFB5 /* ViewStyleManager.swift in Sources */, 188 | 69DC76691DED064B00E4CEDD /* ViewStyleAttributeExtensionSupport.swift in Sources */, 189 | 69517C611DE6318E00C4DFB5 /* ViewStyle.swift in Sources */, 190 | 69517C621DE6318E00C4DFB5 /* ViewStyleAttribute.swift in Sources */, 191 | 69517C631DE6318E00C4DFB5 /* ViewStyleBuilder.swift in Sources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXSourcesBuildPhase section */ 196 | 197 | /* Begin XCBuildConfiguration section */ 198 | 69517C131DE62D1D00C4DFB5 /* Debug */ = { 199 | isa = XCBuildConfiguration; 200 | buildSettings = { 201 | ALWAYS_SEARCH_USER_PATHS = NO; 202 | CLANG_ANALYZER_NONNULL = YES; 203 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 204 | CLANG_CXX_LIBRARY = "libc++"; 205 | CLANG_ENABLE_MODULES = YES; 206 | CLANG_ENABLE_OBJC_ARC = YES; 207 | CLANG_WARN_BOOL_CONVERSION = YES; 208 | CLANG_WARN_CONSTANT_CONVERSION = YES; 209 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 210 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 211 | CLANG_WARN_EMPTY_BODY = YES; 212 | CLANG_WARN_ENUM_CONVERSION = YES; 213 | CLANG_WARN_INFINITE_RECURSION = YES; 214 | CLANG_WARN_INT_CONVERSION = YES; 215 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 216 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 217 | CLANG_WARN_UNREACHABLE_CODE = YES; 218 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 219 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 220 | COPY_PHASE_STRIP = NO; 221 | CURRENT_PROJECT_VERSION = 1; 222 | DEBUG_INFORMATION_FORMAT = dwarf; 223 | ENABLE_STRICT_OBJC_MSGSEND = YES; 224 | ENABLE_TESTABILITY = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_NO_COMMON_BLOCKS = YES; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 240 | MTL_ENABLE_DEBUG_INFO = YES; 241 | ONLY_ACTIVE_ARCH = YES; 242 | SDKROOT = iphoneos; 243 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 244 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 245 | TARGETED_DEVICE_FAMILY = "1,2"; 246 | VERSIONING_SYSTEM = "apple-generic"; 247 | VERSION_INFO_PREFIX = ""; 248 | }; 249 | name = Debug; 250 | }; 251 | 69517C141DE62D1D00C4DFB5 /* Release */ = { 252 | isa = XCBuildConfiguration; 253 | buildSettings = { 254 | ALWAYS_SEARCH_USER_PATHS = NO; 255 | CLANG_ANALYZER_NONNULL = YES; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_WARN_BOOL_CONVERSION = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 264 | CLANG_WARN_EMPTY_BODY = YES; 265 | CLANG_WARN_ENUM_CONVERSION = YES; 266 | CLANG_WARN_INFINITE_RECURSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 270 | CLANG_WARN_UNREACHABLE_CODE = YES; 271 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 272 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 273 | COPY_PHASE_STRIP = NO; 274 | CURRENT_PROJECT_VERSION = 1; 275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 276 | ENABLE_NS_ASSERTIONS = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu99; 279 | GCC_NO_COMMON_BLOCKS = YES; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 287 | MTL_ENABLE_DEBUG_INFO = NO; 288 | SDKROOT = iphoneos; 289 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | VALIDATE_PRODUCT = YES; 292 | VERSIONING_SYSTEM = "apple-generic"; 293 | VERSION_INFO_PREFIX = ""; 294 | }; 295 | name = Release; 296 | }; 297 | 69517C161DE62D1D00C4DFB5 /* Debug */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | CODE_SIGN_IDENTITY = ""; 301 | DEFINES_MODULE = YES; 302 | DEVELOPMENT_TEAM = AFEG59EG8E; 303 | DYLIB_COMPATIBILITY_VERSION = 1; 304 | DYLIB_CURRENT_VERSION = 1; 305 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 306 | INFOPLIST_FILE = StyleKit/Info.plist; 307 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 308 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 309 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 310 | PRODUCT_BUNDLE_IDENTIFIER = com.visuality.StyleKit; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SKIP_INSTALL = YES; 313 | SWIFT_VERSION = 3.0; 314 | }; 315 | name = Debug; 316 | }; 317 | 69517C171DE62D1D00C4DFB5 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | CODE_SIGN_IDENTITY = ""; 321 | DEFINES_MODULE = YES; 322 | DEVELOPMENT_TEAM = AFEG59EG8E; 323 | DYLIB_COMPATIBILITY_VERSION = 1; 324 | DYLIB_CURRENT_VERSION = 1; 325 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 326 | INFOPLIST_FILE = StyleKit/Info.plist; 327 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 328 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 330 | PRODUCT_BUNDLE_IDENTIFIER = com.visuality.StyleKit; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | SKIP_INSTALL = YES; 333 | SWIFT_VERSION = 3.0; 334 | }; 335 | name = Release; 336 | }; 337 | /* End XCBuildConfiguration section */ 338 | 339 | /* Begin XCConfigurationList section */ 340 | 69517C071DE62D1D00C4DFB5 /* Build configuration list for PBXProject "StyleKit" */ = { 341 | isa = XCConfigurationList; 342 | buildConfigurations = ( 343 | 69517C131DE62D1D00C4DFB5 /* Debug */, 344 | 69517C141DE62D1D00C4DFB5 /* Release */, 345 | ); 346 | defaultConfigurationIsVisible = 0; 347 | defaultConfigurationName = Release; 348 | }; 349 | 69517C151DE62D1D00C4DFB5 /* Build configuration list for PBXNativeTarget "StyleKit" */ = { 350 | isa = XCConfigurationList; 351 | buildConfigurations = ( 352 | 69517C161DE62D1D00C4DFB5 /* Debug */, 353 | 69517C171DE62D1D00C4DFB5 /* Release */, 354 | ); 355 | defaultConfigurationIsVisible = 0; 356 | defaultConfigurationName = Release; 357 | }; 358 | /* End XCConfigurationList section */ 359 | }; 360 | rootObject = 69517C041DE62D1D00C4DFB5 /* Project object */; 361 | } 362 | -------------------------------------------------------------------------------- /StyleKit/StyleKit/StyleKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /StyleKit/StyleKit/StyleKit/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 | -------------------------------------------------------------------------------- /StyleKit/StyleKit/StyleKit/StyleKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // StyleKit.h 3 | // StyleKit 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for StyleKit. 12 | FOUNDATION_EXPORT double StyleKitVersionNumber; 13 | 14 | //! Project version string for StyleKit. 15 | FOUNDATION_EXPORT const unsigned char StyleKitVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 69517C561DE62F6100C4DFB5 /* StyleKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69517C551DE62F6100C4DFB5 /* StyleKit.framework */; }; 11 | 69517C571DE62F6100C4DFB5 /* StyleKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 69517C551DE62F6100C4DFB5 /* StyleKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 12 | 69DCD4ED1DE580E3004E1DC2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69DCD4EC1DE580E3004E1DC2 /* AppDelegate.swift */; }; 13 | 69DCD4F41DE580E3004E1DC2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 69DCD4F31DE580E3004E1DC2 /* Assets.xcassets */; }; 14 | 69DCD4F71DE580E3004E1DC2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 69DCD4F51DE580E3004E1DC2 /* LaunchScreen.storyboard */; }; 15 | 69DCD5021DE58144004E1DC2 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69DCD5001DE58144004E1DC2 /* MainViewController.swift */; }; 16 | 69DCD5031DE58144004E1DC2 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 69DCD5011DE58144004E1DC2 /* MainViewController.xib */; }; 17 | 69DCD5101DE58759004E1DC2 /* StyleStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69DCD50F1DE58759004E1DC2 /* StyleStorage.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXCopyFilesBuildPhase section */ 21 | 69517C581DE62F6100C4DFB5 /* Embed Frameworks */ = { 22 | isa = PBXCopyFilesBuildPhase; 23 | buildActionMask = 2147483647; 24 | dstPath = ""; 25 | dstSubfolderSpec = 10; 26 | files = ( 27 | 69517C571DE62F6100C4DFB5 /* StyleKit.framework in Embed Frameworks */, 28 | ); 29 | name = "Embed Frameworks"; 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 69517C551DE62F6100C4DFB5 /* StyleKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = StyleKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 69DCD4E91DE580E3004E1DC2 /* StyleKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StyleKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 69DCD4EC1DE580E3004E1DC2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 69DCD4F31DE580E3004E1DC2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 39 | 69DCD4F61DE580E3004E1DC2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 40 | 69DCD4F81DE580E3004E1DC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 69DCD5001DE58144004E1DC2 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 42 | 69DCD5011DE58144004E1DC2 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = ""; }; 43 | 69DCD50F1DE58759004E1DC2 /* StyleStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StyleStorage.swift; sourceTree = ""; }; 44 | /* End PBXFileReference section */ 45 | 46 | /* Begin PBXFrameworksBuildPhase section */ 47 | 69DCD4E61DE580E3004E1DC2 /* Frameworks */ = { 48 | isa = PBXFrameworksBuildPhase; 49 | buildActionMask = 2147483647; 50 | files = ( 51 | 69517C561DE62F6100C4DFB5 /* StyleKit.framework in Frameworks */, 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 69B456C31DE9088D006BCB8D /* Frameworks */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 69517C551DE62F6100C4DFB5 /* StyleKit.framework */, 62 | ); 63 | name = Frameworks; 64 | sourceTree = ""; 65 | }; 66 | 69DCD4E01DE580E3004E1DC2 = { 67 | isa = PBXGroup; 68 | children = ( 69 | 69DCD4EB1DE580E3004E1DC2 /* StyleKitDemo */, 70 | 69DCD4EA1DE580E3004E1DC2 /* Products */, 71 | ); 72 | sourceTree = ""; 73 | }; 74 | 69DCD4EA1DE580E3004E1DC2 /* Products */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 69DCD4E91DE580E3004E1DC2 /* StyleKitDemo.app */, 78 | ); 79 | name = Products; 80 | sourceTree = ""; 81 | }; 82 | 69DCD4EB1DE580E3004E1DC2 /* StyleKitDemo */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 69DCD50E1DE58748004E1DC2 /* Styles */, 86 | 69DCD4FE1DE58138004E1DC2 /* ViewControllers */, 87 | 69B456C31DE9088D006BCB8D /* Frameworks */, 88 | 69DCD4EC1DE580E3004E1DC2 /* AppDelegate.swift */, 89 | 69DCD4F31DE580E3004E1DC2 /* Assets.xcassets */, 90 | 69DCD4F51DE580E3004E1DC2 /* LaunchScreen.storyboard */, 91 | 69DCD4F81DE580E3004E1DC2 /* Info.plist */, 92 | ); 93 | path = StyleKitDemo; 94 | sourceTree = ""; 95 | }; 96 | 69DCD4FE1DE58138004E1DC2 /* ViewControllers */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 69DCD4FF1DE58138004E1DC2 /* Main */, 100 | ); 101 | path = ViewControllers; 102 | sourceTree = ""; 103 | }; 104 | 69DCD4FF1DE58138004E1DC2 /* Main */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 69DCD5001DE58144004E1DC2 /* MainViewController.swift */, 108 | 69DCD5011DE58144004E1DC2 /* MainViewController.xib */, 109 | ); 110 | path = Main; 111 | sourceTree = ""; 112 | }; 113 | 69DCD50E1DE58748004E1DC2 /* Styles */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 69DCD50F1DE58759004E1DC2 /* StyleStorage.swift */, 117 | ); 118 | path = Styles; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 69DCD4E81DE580E3004E1DC2 /* StyleKitDemo */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 69DCD4FB1DE580E3004E1DC2 /* Build configuration list for PBXNativeTarget "StyleKitDemo" */; 127 | buildPhases = ( 128 | 69DCD4E51DE580E3004E1DC2 /* Sources */, 129 | 69DCD4E61DE580E3004E1DC2 /* Frameworks */, 130 | 69DCD4E71DE580E3004E1DC2 /* Resources */, 131 | 69517C581DE62F6100C4DFB5 /* Embed Frameworks */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | ); 137 | name = StyleKitDemo; 138 | productName = StyleKitDemo; 139 | productReference = 69DCD4E91DE580E3004E1DC2 /* StyleKitDemo.app */; 140 | productType = "com.apple.product-type.application"; 141 | }; 142 | /* End PBXNativeTarget section */ 143 | 144 | /* Begin PBXProject section */ 145 | 69DCD4E11DE580E3004E1DC2 /* Project object */ = { 146 | isa = PBXProject; 147 | attributes = { 148 | LastSwiftUpdateCheck = 0810; 149 | LastUpgradeCheck = 0810; 150 | ORGANIZATIONNAME = Visuality; 151 | TargetAttributes = { 152 | 69DCD4E81DE580E3004E1DC2 = { 153 | CreatedOnToolsVersion = 8.1; 154 | DevelopmentTeam = AFEG59EG8E; 155 | ProvisioningStyle = Automatic; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 69DCD4E41DE580E3004E1DC2 /* Build configuration list for PBXProject "StyleKitDemo" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = English; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 69DCD4E01DE580E3004E1DC2; 168 | productRefGroup = 69DCD4EA1DE580E3004E1DC2 /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 69DCD4E81DE580E3004E1DC2 /* StyleKitDemo */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 69DCD4E71DE580E3004E1DC2 /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 69DCD4F71DE580E3004E1DC2 /* LaunchScreen.storyboard in Resources */, 183 | 69DCD5031DE58144004E1DC2 /* MainViewController.xib in Resources */, 184 | 69DCD4F41DE580E3004E1DC2 /* Assets.xcassets in Resources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXResourcesBuildPhase section */ 189 | 190 | /* Begin PBXSourcesBuildPhase section */ 191 | 69DCD4E51DE580E3004E1DC2 /* Sources */ = { 192 | isa = PBXSourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | 69DCD5101DE58759004E1DC2 /* StyleStorage.swift in Sources */, 196 | 69DCD4ED1DE580E3004E1DC2 /* AppDelegate.swift in Sources */, 197 | 69DCD5021DE58144004E1DC2 /* MainViewController.swift in Sources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXSourcesBuildPhase section */ 202 | 203 | /* Begin PBXVariantGroup section */ 204 | 69DCD4F51DE580E3004E1DC2 /* LaunchScreen.storyboard */ = { 205 | isa = PBXVariantGroup; 206 | children = ( 207 | 69DCD4F61DE580E3004E1DC2 /* Base */, 208 | ); 209 | name = LaunchScreen.storyboard; 210 | sourceTree = ""; 211 | }; 212 | /* End PBXVariantGroup section */ 213 | 214 | /* Begin XCBuildConfiguration section */ 215 | 69DCD4F91DE580E3004E1DC2 /* Debug */ = { 216 | isa = XCBuildConfiguration; 217 | buildSettings = { 218 | ALWAYS_SEARCH_USER_PATHS = NO; 219 | CLANG_ANALYZER_NONNULL = YES; 220 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 221 | CLANG_CXX_LIBRARY = "libc++"; 222 | CLANG_ENABLE_MODULES = YES; 223 | CLANG_ENABLE_OBJC_ARC = YES; 224 | CLANG_WARN_BOOL_CONVERSION = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 227 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INFINITE_RECURSION = YES; 231 | CLANG_WARN_INT_CONVERSION = YES; 232 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 233 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 234 | CLANG_WARN_UNREACHABLE_CODE = YES; 235 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = dwarf; 239 | ENABLE_STRICT_OBJC_MSGSEND = YES; 240 | ENABLE_TESTABILITY = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu99; 242 | GCC_DYNAMIC_NO_PIC = NO; 243 | GCC_NO_COMMON_BLOCKS = YES; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PREPROCESSOR_DEFINITIONS = ( 246 | "DEBUG=1", 247 | "$(inherited)", 248 | ); 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 256 | MTL_ENABLE_DEBUG_INFO = YES; 257 | ONLY_ACTIVE_ARCH = YES; 258 | SDKROOT = iphoneos; 259 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 260 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 261 | TARGETED_DEVICE_FAMILY = "1,2"; 262 | }; 263 | name = Debug; 264 | }; 265 | 69DCD4FA1DE580E3004E1DC2 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BOOL_CONVERSION = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 277 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 278 | CLANG_WARN_EMPTY_BODY = YES; 279 | CLANG_WARN_ENUM_CONVERSION = YES; 280 | CLANG_WARN_INFINITE_RECURSION = YES; 281 | CLANG_WARN_INT_CONVERSION = YES; 282 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 283 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 284 | CLANG_WARN_UNREACHABLE_CODE = YES; 285 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 286 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 287 | COPY_PHASE_STRIP = NO; 288 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 289 | ENABLE_NS_ASSERTIONS = NO; 290 | ENABLE_STRICT_OBJC_MSGSEND = YES; 291 | GCC_C_LANGUAGE_STANDARD = gnu99; 292 | GCC_NO_COMMON_BLOCKS = YES; 293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 295 | GCC_WARN_UNDECLARED_SELECTOR = YES; 296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 297 | GCC_WARN_UNUSED_FUNCTION = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 300 | MTL_ENABLE_DEBUG_INFO = NO; 301 | SDKROOT = iphoneos; 302 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Release; 307 | }; 308 | 69DCD4FC1DE580E3004E1DC2 /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 312 | DEVELOPMENT_TEAM = AFEG59EG8E; 313 | INFOPLIST_FILE = StyleKitDemo/Info.plist; 314 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 315 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 316 | PRODUCT_BUNDLE_IDENTIFIER = com.visuality.StyleKitDemo; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_INSTALL_OBJC_HEADER = YES; 319 | SWIFT_VERSION = 3.0; 320 | TARGETED_DEVICE_FAMILY = 1; 321 | }; 322 | name = Debug; 323 | }; 324 | 69DCD4FD1DE580E3004E1DC2 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 328 | DEVELOPMENT_TEAM = AFEG59EG8E; 329 | INFOPLIST_FILE = StyleKitDemo/Info.plist; 330 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 331 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 332 | PRODUCT_BUNDLE_IDENTIFIER = com.visuality.StyleKitDemo; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SWIFT_INSTALL_OBJC_HEADER = YES; 335 | SWIFT_VERSION = 3.0; 336 | TARGETED_DEVICE_FAMILY = 1; 337 | }; 338 | name = Release; 339 | }; 340 | /* End XCBuildConfiguration section */ 341 | 342 | /* Begin XCConfigurationList section */ 343 | 69DCD4E41DE580E3004E1DC2 /* Build configuration list for PBXProject "StyleKitDemo" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | 69DCD4F91DE580E3004E1DC2 /* Debug */, 347 | 69DCD4FA1DE580E3004E1DC2 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | 69DCD4FB1DE580E3004E1DC2 /* Build configuration list for PBXNativeTarget "StyleKitDemo" */ = { 353 | isa = XCConfigurationList; 354 | buildConfigurations = ( 355 | 69DCD4FC1DE580E3004E1DC2 /* Debug */, 356 | 69DCD4FD1DE580E3004E1DC2 /* Release */, 357 | ); 358 | defaultConfigurationIsVisible = 0; 359 | defaultConfigurationName = Release; 360 | }; 361 | /* End XCConfigurationList section */ 362 | }; 363 | rootObject = 69DCD4E11DE580E3004E1DC2 /* Project object */; 364 | } 365 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // StyleKitDemo 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | // MARK: Class variables & properties 15 | 16 | // MARK: Public class methods 17 | 18 | // MARK: Private class methods 19 | 20 | // MARK: Initializers 21 | 22 | // MARK: Deinitializer 23 | 24 | deinit { 25 | } 26 | 27 | // MARK: Object variables & properties 28 | 29 | var window: UIWindow? 30 | 31 | // MARK: Public object methods 32 | 33 | // MARK: Private object methods 34 | 35 | // MARK: Protocol methods 36 | 37 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 38 | // Create window 39 | 40 | let frameForWindow = UIScreen.main.bounds 41 | window = UIWindow(frame: frameForWindow) 42 | window!.backgroundColor = .white 43 | window!.makeKeyAndVisible() 44 | 45 | // Switch to main flow 46 | 47 | let mainViewController = MainViewController(nibName: "MainViewController", bundle: nil) 48 | 49 | let navigationController = UINavigationController(rootViewController: mainViewController) 50 | navigationController.isNavigationBarHidden = false 51 | 52 | window!.rootViewController = navigationController 53 | 54 | // Return result 55 | 56 | return true 57 | } 58 | 59 | func applicationWillResignActive(_ application: UIApplication) { 60 | // 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. 61 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 62 | } 63 | 64 | func applicationDidEnterBackground(_ application: UIApplication) { 65 | // 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. 66 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 67 | } 68 | 69 | func applicationWillEnterForeground(_ application: UIApplication) { 70 | // 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. 71 | } 72 | 73 | func applicationDidBecomeActive(_ application: UIApplication) { 74 | // 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. 75 | } 76 | 77 | func applicationWillTerminate(_ application: UIApplication) { 78 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 79 | } 80 | 81 | } 82 | 83 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/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 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/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 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/Styles/StyleStorage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StyleStorage.swift 3 | // StyleKitDemo 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import StyleKit 12 | 13 | struct StyleStorage { 14 | static let simpleBackground = ViewStyle.with(attribute: .backgroundColor(color: .white)) 15 | .and(attribute: .borderColor(color: .green)) 16 | .and(attribute: .borderWidth(width: 2.0)) 17 | .done() 18 | 19 | static let thinOrangeText = ViewStyle.with(attribute: .textColor(color: .orange)) 20 | .and(attribute: .font(font: UIFont.systemFont(ofSize: 36.0, weight: UIFontWeightThin))) 21 | .done() 22 | } 23 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/ViewControllers/Main/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.swift 3 | // StyleKitDemo 4 | // 5 | // Created by Igor Matyushkin on 23.11.16. 6 | // Copyright © 2016 Visuality. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import StyleKit 11 | 12 | class MainViewController: UIViewController { 13 | 14 | // MARK: Class variables & properties 15 | 16 | // MARK: Public class methods 17 | 18 | // MARK: Private class methods 19 | 20 | // MARK: Initializers 21 | 22 | // MARK: Deinitializer 23 | 24 | deinit { 25 | } 26 | 27 | // MARK: Outlets 28 | 29 | @IBOutlet fileprivate weak var helloLabel: UILabel! 30 | 31 | // MARK: Object variables & properties 32 | 33 | // MARK: Public object methods 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | 38 | /** 39 | * Initialize view. 40 | */ 41 | 42 | if StyleStorage.simpleBackground.supports(view: view) { 43 | view.stl.apply(style: StyleStorage.simpleBackground) 44 | } 45 | 46 | /** 47 | * Initialize hello label. 48 | */ 49 | 50 | if StyleStorage.thinOrangeText.supports(view: helloLabel) { 51 | helloLabel.stl.apply(style: StyleStorage.thinOrangeText) 52 | } 53 | } 54 | 55 | override func didReceiveMemoryWarning() { 56 | super.didReceiveMemoryWarning() 57 | // Dispose of any resources that can be recreated. 58 | } 59 | 60 | // MARK: Private object methods 61 | 62 | // MARK: Actions 63 | 64 | // MARK: Protocol methods 65 | 66 | } 67 | -------------------------------------------------------------------------------- /StyleKit/StyleKitDemo/StyleKitDemo/ViewControllers/Main/MainViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /UIStyle.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint ViewStyles.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "UIStyle" 19 | s.version = "1.2" 20 | s.summary = "CSS for iOS." 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | s.description = <<-DESC 28 | Super easy framework for managing visual styles in iOS. Written in Swift. 29 | DESC 30 | 31 | s.homepage = "https://github.com/igormatyushkin014/StyleKit" 32 | s.screenshots = "https://github.com/igormatyushkin014/StyleKit/raw/master/Images/logo-1024-300.png" 33 | 34 | 35 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 36 | # 37 | # Licensing your code is important. See http://choosealicense.com for more info. 38 | # CocoaPods will detect a license file if there is a named LICENSE* 39 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 40 | # 41 | 42 | #s.license = "MIT" 43 | s.license = { :type => "MIT", :file => "LICENSE" } 44 | 45 | 46 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 47 | # 48 | # Specify the authors of the library, with email addresses. Email addresses 49 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 50 | # accepts just a name if you'd rather not provide an email address. 51 | # 52 | # Specify a social_media_url where others can refer to, for example a twitter 53 | # profile URL. 54 | # 55 | 56 | s.author = { "Igor Matyushkin" => "igormatyushkin014@gmail.com" } 57 | #s.author = "Igor Matyushkin" 58 | # s.authors = { "Igor Matyushkin" => "igormatyushkin014@gmail.com" } 59 | s.social_media_url = "https://twitter.com/igormatyushkin1" 60 | 61 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 62 | # 63 | # If this Pod runs only on iOS or OS X, then specify the platform and 64 | # the deployment target. You can optionally include the target after the platform. 65 | # 66 | 67 | # s.platform = :ios 68 | s.platform = :ios, "9.0" 69 | 70 | # When using multiple platforms 71 | # s.ios.deployment_target = "5.0" 72 | # s.osx.deployment_target = "10.7" 73 | # s.watchos.deployment_target = "2.0" 74 | # s.tvos.deployment_target = "9.0" 75 | 76 | 77 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 78 | # 79 | # Specify the location from where the source should be retrieved. 80 | # Supports git, hg, bzr, svn and HTTP. 81 | # 82 | 83 | s.source = { :git => "https://github.com/igormatyushkin014/StyleKit.git", :tag => s.version } 84 | 85 | 86 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 87 | # 88 | # CocoaPods is smart about how it includes source code. For source files 89 | # giving a folder will include any swift, h, m, mm, c & cpp files. 90 | # For header files it will include any header in the folder. 91 | # Not including the public_header_files will make all headers public. 92 | # 93 | 94 | s.source_files = "Source", "Source/**/*" 95 | #s.exclude_files = "Classes/Exclude" 96 | 97 | # s.public_header_files = "Classes/**/*.h" 98 | 99 | 100 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 101 | # 102 | # A list of resources included with the Pod. These are copied into the 103 | # target bundle with a build phase script. Anything else will be cleaned. 104 | # You can preserve files from being cleaned, please don't preserve 105 | # non-essential files like tests, examples and documentation. 106 | # 107 | 108 | # s.resource = "icon.png" 109 | # s.resources = "Resources/*.png" 110 | 111 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 112 | 113 | 114 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 115 | # 116 | # Link your library with frameworks, or libraries. Libraries do not include 117 | # the lib prefix of their name. 118 | # 119 | 120 | # s.framework = "SomeFramework" 121 | # s.frameworks = "SomeFramework", "AnotherFramework" 122 | 123 | # s.library = "iconv" 124 | # s.libraries = "iconv", "xml2" 125 | 126 | 127 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 128 | # 129 | # If your library depends on compiler flags you can set them in the xcconfig hash 130 | # where they will only apply to your library. If you depend on other Podspecs 131 | # you can include multiple dependencies to ensure it works. 132 | 133 | # s.requires_arc = true 134 | 135 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 136 | # s.dependency "JSONKit", "~> 1.4" 137 | 138 | end 139 | --------------------------------------------------------------------------------