├── AFUIKit.podspec ├── AFUIKit ├── AFExtensionDefine.h ├── AFUIKitExample-Bridging-Header.h ├── NSAttributedString+AFExtension.swift ├── NSMutableAttributedString+AFExtension.swift ├── UIButton+AFExtension.swift ├── UIImageView+AFExtension.swift ├── UILabel+AFExtension.swift ├── UITableView+AFExtension.swift ├── UITableViewController+AFExtension.swift ├── UITextField+AFExtension.swift ├── UITextView+AFExtension.swift ├── UIView+AFExtension.swift ├── UIViewController+AFExtension.swift ├── UI视图.swift ├── UI颜色.swift └── 大小.swift ├── AFUIKitExample ├── AFUIKitExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ ├── koudaiwang.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── yihui.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── koudaiwang.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── AFUIKitExample.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── yihui.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── AFUIKitExample.xcscheme │ │ └── xcschememanagement.plist ├── AFUIKitExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift └── README.md ├── LICENSE ├── README.md ├── code.png └── 任务清单.numbers /AFUIKit.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = "AFUIKit" 4 | s.version = "1.1.0" 5 | s.summary = "Swift UIKit chained calls Framework" 6 | s.homepage = "https://github.com/myafer" 7 | s.license = { :type => "MIT" } 8 | s.author = { "myafer" => "791143125@qq.com" } 9 | 10 | s.requires_arc = true 11 | s.ios.deployment_target = "8.0" 12 | s.source = { :git => "https://github.com/myafer/AFUIKit.git", :tag => "#{s.version}" } 13 | s.source_files = "AFUIKit/**/*.swift" 14 | s.pod_target_xcconfig = { 15 | 'SWIFT_VERSION' => '3.0', 16 | } 17 | end 18 | -------------------------------------------------------------------------------- /AFUIKit/AFExtensionDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFExtensionDefine.h 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/9/30. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | #ifndef AFExtensionDefine_h 10 | #define AFExtensionDefine_h 11 | 12 | #define HASAJI self 13 | 14 | #endif /* AFExtensionDefine_h */ 15 | -------------------------------------------------------------------------------- /AFUIKit/AFUIKitExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "AFExtensionDefine.h" 6 | -------------------------------------------------------------------------------- /AFUIKit/NSAttributedString+AFExtension.swift: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // NSAttributedString+AFExtension.swift 4 | // AFUIKitExample 5 | // 6 | // Created by 口贷网 on 16/8/17. 7 | // Copyright © 2016年 Afer. All rights reserved. 8 | // 9 | 10 | import UIKit 11 | 12 | extension NSAttributedString { 13 | 14 | 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /AFUIKit/NSMutableAttributedString+AFExtension.swift: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // NSMutableAttributedString+AFExtension.swift 4 | // AFUIKitExample 5 | // 6 | // Created by 口贷网 on 16/8/17. 7 | // Copyright © 2016年 Afer. All rights reserved. 8 | // 9 | 10 | import UIKit 11 | 12 | 13 | @available(iOS 6.0, *) 14 | public let AFFont = NSFontAttributeName 15 | 16 | @available(iOS 6.0, *) 17 | public let AFParagraphStyle = NSParagraphStyleAttributeName 18 | 19 | @available(iOS 6.0, *) 20 | public let AFFontColor = NSForegroundColorAttributeName 21 | 22 | @available(iOS 6.0, *) 23 | public let AFBgColor = NSBackgroundColorAttributeName 24 | 25 | @available(iOS 6.0, *) 26 | public let AFLigature = NSLigatureAttributeName 27 | 28 | @available(iOS 6.0, *) 29 | public let AFKern = NSKernAttributeName 30 | 31 | @available(iOS 6.0, *) 32 | public let AFStrikethroughStyle = NSStrikethroughStyleAttributeName 33 | 34 | @available(iOS 6.0, *) 35 | public let AFUnderlineStyle = NSUnderlineStyleAttributeName 36 | 37 | @available(iOS 6.0, *) 38 | public let AStrokeColor = NSStrokeColorAttributeName 39 | 40 | @available(iOS 6.0, *) 41 | public let AFStrokeWidth = NSStrokeWidthAttributeName 42 | 43 | @available(iOS 6.0, *) 44 | public let AFShadow = NSShadowAttributeName 45 | 46 | @available(iOS 7.0, *) 47 | public let AFTextEffect = NSTextEffectAttributeName 48 | 49 | @available(iOS 7.0, *) 50 | public let AFAttachment = NSAttachmentAttributeName 51 | 52 | @available(iOS 7.0, *) 53 | public let AFLink = NSLinkAttributeName 54 | 55 | @available(iOS 7.0, *) 56 | public let AFBaselineOffset = NSBaselineOffsetAttributeName 57 | 58 | @available(iOS 7.0, *) 59 | public let AFStrikethroughColor = NSStrikethroughColorAttributeName 60 | 61 | @available(iOS 7.0, *) 62 | public let AFObliqueness = NSObliquenessAttributeName 63 | 64 | @available(iOS 7.0, *) 65 | public let AFExpansion = NSExpansionAttributeName 66 | 67 | @available(iOS 7.0, *) 68 | public let AFWritingDirection = NSWritingDirectionAttributeName 69 | 70 | @available(iOS 7.0, *) 71 | public let AFVerticalGlyphForm = NSVerticalGlyphFormAttributeName 72 | 73 | extension NSMutableAttributedString { 74 | 75 | public func append_attr(_ string: String, _ attributes: [String : AnyObject]?) -> Self { 76 | let attr = NSAttributedString.init(string: string, attributes: attributes) 77 | append(attr) 78 | return self 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /AFUIKit/UIButton+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIButton { 12 | 13 | // MARK: Button targer 14 | 15 | public func target(_ target: AnyObject?, action: Selector, forControlEvents: UIControlEvents) -> Self { 16 | addTarget(target, action: action, for: forControlEvents) 17 | return self 18 | } 19 | 20 | // MARK: button title 21 | 22 | public func title(_ value: String, state: UIControlState) -> Self { 23 | setTitle(value, for: state) 24 | return self 25 | } 26 | 27 | public func nomalStateTitle(_ value: String) -> Self { 28 | setTitle(value, for: .normal) 29 | return self 30 | } 31 | 32 | public func highlightedStateTitle(_ value: String) -> Self { 33 | setTitle(value, for: .highlighted) 34 | return self 35 | } 36 | 37 | 38 | public func selectedStateTitle(_ value: String) -> Self { 39 | setTitle(value, for: .selected) 40 | return self 41 | } 42 | 43 | // MARK: button title color 44 | 45 | public func titleColor(_ value: UIColor, state: UIControlState) -> Self { 46 | setTitleColor(value, for: state) 47 | return self 48 | } 49 | 50 | public func nomalStateTitleColor(_ value: UIColor) -> Self { 51 | setTitleColor(value, for: .normal) 52 | return self 53 | } 54 | 55 | public func highlightedStateTitleColor(_ value: UIColor) -> Self { 56 | setTitleColor(value, for: .highlighted) 57 | return self 58 | } 59 | 60 | public func selectedStateTitleColor(_ value: UIColor) -> Self { 61 | setTitleColor(value, for: .selected) 62 | return self 63 | } 64 | 65 | // MARK: button title shadow color 66 | 67 | public func titleShadowColor(_ value: UIColor, state: UIControlState) -> Self { 68 | setTitleShadowColor(value, for: state) 69 | return self 70 | } 71 | 72 | public func nomalStateTitleShadowColor(_ value: UIColor) -> Self { 73 | setTitleShadowColor(value, for: .normal) 74 | return self 75 | } 76 | 77 | public func highlightedStateTitleShadowColor(_ value: UIColor) -> Self { 78 | setTitleShadowColor(value, for: .highlighted) 79 | return self 80 | } 81 | 82 | public func selectedStateTitleShadowColor(_ value: UIColor) -> Self { 83 | setTitleShadowColor(value, for: .selected) 84 | return self 85 | } 86 | 87 | 88 | // MARK: button image 89 | 90 | public func image(_ value: UIImage, state: UIControlState) -> Self { 91 | setImage(value, for: state) 92 | return self 93 | } 94 | 95 | public func nomalStateImage(_ value: UIImage) -> Self { 96 | setImage(value, for: .normal) 97 | return self 98 | } 99 | 100 | public func highlightedStateImage(_ value: UIImage) -> Self { 101 | setImage(value, for: .highlighted) 102 | return self 103 | } 104 | 105 | 106 | public func selectedStateImage(_ value: UIImage) -> Self { 107 | setImage(value, for: .selected) 108 | return self 109 | } 110 | 111 | // MARK: button background image 112 | 113 | public func backgroundImage(_ image: UIImage, state: UIControlState) -> Self { 114 | setBackgroundImage(image, for: state) 115 | return self 116 | } 117 | 118 | public func nomalStateBackgroundImage(_ value: UIImage) -> Self { 119 | setBackgroundImage(value, for: .normal) 120 | return self 121 | } 122 | 123 | public func highlightedStateBackgroundImage(_ value: UIImage) -> Self { 124 | setBackgroundImage(value, for: .highlighted) 125 | return self 126 | } 127 | 128 | 129 | public func selectedStateBackgroundImage(_ value: UIImage) -> Self { 130 | setBackgroundImage(value, for: .selected) 131 | return self 132 | } 133 | 134 | // MARK: button Attributed Title 135 | 136 | public func attributedTitle(_ attr: NSAttributedString, state: UIControlState) -> Self { 137 | setAttributedTitle(attr, for: state) 138 | return self 139 | } 140 | 141 | public func normalStateAttributedTitle(_ attr: NSAttributedString) -> Self { 142 | setAttributedTitle(attr, for: .normal) 143 | return self 144 | } 145 | 146 | public func selectedStateAttributedTitle(_ attr: NSAttributedString) -> Self { 147 | setAttributedTitle(attr, for: .selected) 148 | return self 149 | } 150 | 151 | public func highLightedStateAttributedTitle(_ attr: NSAttributedString) -> Self { 152 | setAttributedTitle(attr, for: .highlighted) 153 | return self 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /AFUIKit/UIImageView+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/5. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIImageView { 12 | 13 | // default is nil 14 | public func image(_ value: UIImage?) -> Self { 15 | image = value 16 | return self 17 | } 18 | 19 | // default is nil 20 | @available(iOS 3.0, *) 21 | public func highlightedImage(_ value: UIImage?) -> Self { 22 | highlightedImage = value 23 | return self 24 | } 25 | 26 | // default is NO 27 | public func highlighted(_ value: Bool) -> Self { 28 | isHighlighted = value 29 | return self 30 | } 31 | 32 | // these allow a set of images to be animated. the array may contain multiple copies of the same 33 | // The array must contain UIImages. Setting hides the single image. default is nil 34 | public func animationImages(_ value: [UIImage]?) -> Self { 35 | animationImages = value 36 | return self 37 | } 38 | 39 | // The array must contain UIImages. Setting hides the single image. default is nil 40 | @available(iOS 3.0, *) 41 | public func highlightedAnimationImages(_ value: [UIImage]?) -> Self { 42 | highlightedAnimationImages = value 43 | return self 44 | } 45 | 46 | // for one cycle of images. default is number of images * 1/30th of a second (i.e. 30 fps) 47 | public func animationDuration(_ value: TimeInterval) -> Self { 48 | animationDuration = value 49 | return self 50 | } 51 | 52 | // 0 means infinite (default is 0) 53 | public func animationRepeatCount(_ value: Int) -> Self { 54 | animationRepeatCount = value 55 | return self 56 | } 57 | 58 | // // When tintColor is non-nil, any template images set on the image view will be colorized with that color. 59 | // // The tintColor is inherited through the superview hierarchy. See UIView for more information. 60 | // @available(iOS 7.0, *) 61 | // public func tintColor(_ value: UIColor!) -> Self { 62 | // tintColor = value 63 | // return self 64 | // } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /AFUIKit/UILabel+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by Afer on 16/8/4. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UILabel { 12 | 13 | // default is nil 14 | public func text(_ value: String?) -> Self { 15 | text = value 16 | return self 17 | } 18 | 19 | // default is nil (system font 17 plain) 20 | public func font(_ value: UIFont!) -> Self { 21 | font = value 22 | return self 23 | } 24 | 25 | // default is nil (text draws black) 26 | public func textColor(_ value: UIColor!) -> Self { 27 | textColor = value 28 | return self 29 | } 30 | 31 | // default is nil (no shadow) 32 | public func shadowColor(_ value: UIColor?) -> Self { 33 | shadowColor = value 34 | return self 35 | } 36 | 37 | // default is CGSizeMake(0, -1) -- a top shadow 38 | public func shadowOffset(_ value: CGSize) -> Self { 39 | shadowOffset = value 40 | return self 41 | } 42 | 43 | // default is NSTextAlignmentLeft 44 | public func textAlignment(_ value: NSTextAlignment) -> Self { 45 | textAlignment = value 46 | return self 47 | } 48 | 49 | // default is NSLineBreakByTruncatingTail. used for single and multiple lines of text 50 | public func lineBreakMode(_ value: NSLineBreakMode) -> Self { 51 | lineBreakMode = value 52 | return self 53 | } 54 | 55 | // the underlying attributed string drawn by the label, if set, the label ignores the properties above. 56 | // default is nil 57 | @available(iOS 6.0, *) 58 | public func attributedText(_ value: NSAttributedString?) -> Self { 59 | attributedText = value 60 | return self 61 | } 62 | 63 | // the 'highlight' property is used by subclasses for such things as pressed states. it's useful to make it part of the base class as a user property 64 | // default is nil 65 | public func highlightedTextColor(_ value: UIColor?) -> Self { 66 | highlightedTextColor = value 67 | return self 68 | } 69 | 70 | // default is NO 71 | public func highlighted(_ value: Bool) -> Self { 72 | isHighlighted = value 73 | return self 74 | } 75 | 76 | // default is NO 77 | // can not be written 78 | // public func userInteractionEnabledd(_ value: Bool) -> Self { 79 | // userInteractionEnabled = value 80 | // return self 81 | // } 82 | 83 | // default is YES. changes how the label is drawn 84 | public func enabled(_ value: Bool) -> Self { 85 | isEnabled = value 86 | return self 87 | } 88 | 89 | 90 | 91 | 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /AFUIKit/UITableView+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/8. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITableView { 12 | 13 | public func dataSource(_ value: UITableViewDataSource?) -> Self { 14 | dataSource = value 15 | return self 16 | } 17 | 18 | // public func delegate(_ value: UITableViewDelegate?) -> Self { 19 | // delegate = value 20 | // return self 21 | // } 22 | 23 | public func rowHeight(_ value: CGFloat) -> Self { 24 | rowHeight = value 25 | return self 26 | } 27 | 28 | public func sectionHeaderHeight(_ value: CGFloat) -> Self { 29 | sectionHeaderHeight = value 30 | return self 31 | } 32 | 33 | public func sectionFooterHeight(_ value: CGFloat) -> Self { 34 | sectionFooterHeight = value 35 | return self 36 | } 37 | 38 | @available(iOS 7.0, *) 39 | public func estimatedRowHeight(_ value: CGFloat) -> Self { 40 | estimatedRowHeight = value 41 | return self 42 | } 43 | 44 | @available(iOS 7.0, *) 45 | public func estimatedSectionHeaderHeight(_ value: CGFloat) -> Self { 46 | estimatedSectionHeaderHeight = value 47 | return self 48 | } 49 | 50 | @available(iOS 7.0, *) 51 | public func estimatedSectionFooterHeight(_ value: CGFloat) -> Self { 52 | estimatedSectionFooterHeight = value 53 | return self 54 | } 55 | 56 | @available(iOS 7.0, *) 57 | public func separatorInset(_ value: UIEdgeInsets) -> Self { 58 | separatorInset = value 59 | return self 60 | } 61 | 62 | @available(iOS 3.2, *) 63 | public func backgroundView(_ value: UIView?) -> Self { 64 | backgroundView = value 65 | return self 66 | } 67 | 68 | public func sectionIndexMinimumDisplayRowCount(_ value: Int) -> Self { 69 | sectionIndexMinimumDisplayRowCount = value 70 | return self 71 | } 72 | 73 | @available(iOS 6.0, *) 74 | public func sectionIndexColor(_ value: UIColor?) -> Self { 75 | sectionIndexColor = value 76 | return self 77 | } 78 | 79 | @available(iOS 7.0, *) 80 | public func sectionIndexBackgroundColor(_ value: UIColor?) -> Self { 81 | sectionIndexBackgroundColor = value 82 | return self 83 | } 84 | 85 | @available(iOS 6.0, *) 86 | public func sectionIndexTrackingBackgroundColor(_ value: UIColor?) -> Self { 87 | sectionIndexTrackingBackgroundColor = value 88 | return self 89 | } 90 | 91 | public func separatorStyle(_ value: UITableViewCellSeparatorStyle) -> Self { 92 | separatorStyle = value 93 | return self 94 | } 95 | 96 | public func separatorColor(_ value: UIColor?) -> Self { 97 | separatorColor = value 98 | return self 99 | } 100 | 101 | @available(iOS 8.0, *) 102 | public func separatorEffect(_ value: UIVisualEffect?) -> Self { 103 | separatorEffect = value 104 | return self 105 | } 106 | 107 | @available(iOS 9.0, *) 108 | public func cellLayoutMarginsFollowReadableWidth(_ value: Bool) -> Self { 109 | cellLayoutMarginsFollowReadableWidth = value 110 | return self 111 | } 112 | 113 | public func tableHeaderView(_ value: UIView?) -> Self { 114 | tableHeaderView = value 115 | return self 116 | } 117 | 118 | public func tableFooterView(_ value: UIView?) -> Self { 119 | tableFooterView = value 120 | return self 121 | } 122 | 123 | @available(iOS 9.0, *) 124 | public func remembersLastFocusedIndexPath(_ value: Bool) -> Self { 125 | remembersLastFocusedIndexPath = value 126 | return self 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /AFUIKit/UITableViewController+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewController+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/8. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITableViewController { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /AFUIKit/UITextField+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/15. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITextField { 12 | 13 | // default is nil 14 | public func text(_ value: String?) -> Self { 15 | text = value 16 | return self 17 | } 18 | 19 | // default is nil 20 | @available(iOS 6.0, *) 21 | public func attributedText(_ value: NSAttributedString?) -> Self { 22 | attributedText = value 23 | return self 24 | } 25 | 26 | // default is nil. use opaque black 27 | public func textColor(_ value: UIColor?) -> Self { 28 | textColor = value 29 | return self 30 | } 31 | 32 | // default is nil. use system font 12 pt 33 | public func font(_ value: UIFont?) -> Self { 34 | font = value 35 | return self 36 | } 37 | 38 | // default is NSLeftTextAlignment 39 | public func textAlignment(_ value: NSTextAlignment) -> Self { 40 | textAlignment = value 41 | return self 42 | } 43 | 44 | // default is UITextBorderStyleNone. If set to UITextBorderStyleRoundedRect, custom background images are ignored. 45 | public func borderStyle(_ value: UITextBorderStyle) -> Self { 46 | borderStyle = value 47 | return self 48 | } 49 | 50 | // applies attributes to the full range of text. Unset attributes act like default values. 51 | @available(iOS 7.0, *) 52 | public func defaultTextAttributes(_ value: [String : AnyObject]) -> Self { 53 | defaultTextAttributes = value 54 | return self 55 | } 56 | 57 | // default is nil. string is drawn 70% gray 58 | public func placeholder(_ value: String?) -> Self { 59 | placeholder = value 60 | return self 61 | } 62 | 63 | // default is nil 64 | @available(iOS 6.0, *) 65 | public func attributedPlaceholder(_ value: NSAttributedString?) -> Self { 66 | attributedPlaceholder = value 67 | return self 68 | } 69 | 70 | // default is NO which moves cursor to location clicked. if YES, all text cleared 71 | public func clearsOnBeginEditing(_ value: Bool) -> Self { 72 | clearsOnBeginEditing = value 73 | return self 74 | } 75 | 76 | // default is NO. if YES, text will shrink to minFontSize along baseline 77 | public func adjustsFontSizeToFitWidth(_ value: Bool) -> Self { 78 | adjustsFontSizeToFitWidth = value 79 | return self 80 | } 81 | 82 | // default is 0.0. actual min may be pinned to something readable. used if adjustsFontSizeToFitWidth is YES 83 | public func minimumFontSize(_ value: CGFloat) -> Self { 84 | minimumFontSize = value 85 | return self 86 | } 87 | 88 | // default is nil. weak reference 89 | public func delegate(_ value: UITextFieldDelegate?) -> Self { 90 | delegate = value 91 | return self 92 | } 93 | 94 | // default is nil. draw in border rect. image should be stretchable 95 | public func background(_ value: UIImage?) -> Self { 96 | background = value 97 | return self 98 | } 99 | 100 | // default is nil. ignored if background not set. image should be stretchable 101 | public func disabledBackground(_ value: UIImage?) -> Self { 102 | disabledBackground = value 103 | return self 104 | } 105 | 106 | // default is NO. allows editing text attributes with style operations and pasting rich text 107 | @available(iOS 6.0, *) 108 | public func allowsEditingTextAttributes(_ value: Bool) -> Self { 109 | allowsEditingTextAttributes = value 110 | return self 111 | } 112 | 113 | // automatically resets when the selection changes 114 | @available(iOS 6.0, *) 115 | public func typingAttributes(_ value: [String : AnyObject]?) -> Self { 116 | typingAttributes = value 117 | return self 118 | } 119 | 120 | // You can supply custom views which are displayed at the left or right 121 | // sides of the text field. Uses for such views could be to show an icon or 122 | // a button to operate on the text in the field in an application-defined 123 | // manner. 124 | // 125 | // A very common use is to display a clear button on the right side of the 126 | // text field, and a standard clear button is provided. 127 | 128 | 129 | // sets when the clear button shows up. default is UITextFieldViewModeNever 130 | public func clearButtonMode(_ value: UITextFieldViewMode) -> Self { 131 | clearButtonMode = value 132 | return self 133 | } 134 | 135 | // e.g. magnifying glass 136 | public func leftView(_ value: UIView?) -> Self { 137 | leftView = value 138 | return self 139 | } 140 | 141 | // sets when the left view shows up. default is UITextFieldViewModeNever 142 | public func leftViewMode(_ value: UITextFieldViewMode) -> Self { 143 | leftViewMode = value 144 | return self 145 | } 146 | 147 | // e.g. bookmarks button 148 | public func rightView(_ value: UIView?) -> Self { 149 | rightView = value 150 | return self 151 | } 152 | 153 | // sets when the right view shows up. default is UITextFieldViewModeNever 154 | public func rightViewMode(_ value: UITextFieldViewMode) -> Self { 155 | rightViewMode = value 156 | return self 157 | } 158 | 159 | // Presented when object becomes first responder. If set to nil, reverts to following responder chain. If 160 | // set while first responder, will not take effect until reloadInputViews is called. 161 | public func inputView(_ value: UIView?) -> Self { 162 | inputView = value 163 | return self 164 | } 165 | 166 | public func inputAccessoryView(_ value: UIView?) -> Self { 167 | inputAccessoryView = value 168 | return self 169 | } 170 | 171 | // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO. 172 | @available(iOS 6.0, *) 173 | public func clearsOnInsertion(_ value: Bool) -> Self { 174 | clearsOnInsertion = value 175 | return self 176 | } 177 | 178 | } 179 | -------------------------------------------------------------------------------- /AFUIKit/UITextView+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITextView+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/16. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | 10 | 11 | import UIKit 12 | 13 | extension UITextView { 14 | 15 | public func text(_ value: String!) -> Self { 16 | text = value 17 | return self 18 | } 19 | 20 | public func font(_ value: UIFont?) -> Self { 21 | font = value 22 | return self 23 | } 24 | 25 | public func textColor(_ value: UIColor?) -> Self { 26 | textColor = value 27 | return self 28 | } 29 | 30 | // default is NSLeftTextAlignment 31 | public func textAlignment(_ value: NSTextAlignment) -> Self { 32 | textAlignment = value 33 | return self 34 | } 35 | 36 | public func selectedRange(_ value: NSRange) -> Self { 37 | selectedRange = value 38 | return self 39 | } 40 | 41 | public func editable(_ value: Bool) -> Self { 42 | isEditable = value 43 | return self 44 | } 45 | 46 | // toggle selectability, which controls the ability of the user to select content and interact with URLs & attachments 47 | @available(iOS 7.0, *) 48 | public func selectable(_ value: Bool) -> Self { 49 | isSelectable = value 50 | return self 51 | } 52 | 53 | @available(iOS 3.0, *) 54 | public func dataDetectorTypes(_ value: UIDataDetectorTypes) -> Self { 55 | dataDetectorTypes = value 56 | return self 57 | } 58 | 59 | // defaults to NO 60 | @available(iOS 6.0, *) 61 | public func allowsEditingTextAttributes(_ value: Bool) -> Self { 62 | allowsEditingTextAttributes = value 63 | return self 64 | } 65 | 66 | @available(iOS 6.0, *) 67 | public func attributedText(_ value: NSAttributedString!) -> Self { 68 | attributedText = value 69 | return self 70 | } 71 | 72 | // automatically resets when the selection changes 73 | @available(iOS 6.0, *) 74 | public func typingAttributes(_ value: [String : AnyObject]) -> Self { 75 | typingAttributes = value 76 | return self 77 | } 78 | 79 | // Presented when object becomes first responder. If set to nil, reverts to following responder chain. If 80 | // set while first responder, will not take effect until reloadInputViews is called. 81 | public func inputView(_ value: UIView?) -> Self { 82 | inputView = value 83 | return self 84 | } 85 | 86 | public func inputAccessoryView(_ value: UIView?) -> Self { 87 | inputAccessoryView = value 88 | return self 89 | } 90 | 91 | // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO. 92 | @available(iOS 6.0, *) 93 | public func clearsOnInsertion(_ value:Bool) -> Self { 94 | clearsOnInsertion = value 95 | return self 96 | } 97 | 98 | // Inset the text container's layout area within the text view's content area 99 | @available(iOS 7.0, *) 100 | public func textContainerInset(_ value:UIEdgeInsets) -> Self { 101 | textContainerInset = value 102 | return self 103 | } 104 | 105 | // Style for links 106 | @available(iOS 7.0, *) 107 | public func linkTextAttributes(_ value:[String : AnyObject]!) -> Self { 108 | linkTextAttributes = value 109 | return self 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /AFUIKit/UIView+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | 13 | public func frame(_ value: CGRect) -> Self { 14 | frame = value 15 | return self 16 | } 17 | 18 | public func userInteractionEnabled(_ value: Bool) -> Self { 19 | isUserInteractionEnabled = value 20 | return self 21 | } 22 | 23 | public func backgroundColor(_ value: UIColor) -> Self { 24 | backgroundColor = value 25 | return self 26 | } 27 | 28 | public func bgColor(_ value: UIColor) -> Self { 29 | backgroundColor = value 30 | return self 31 | } 32 | 33 | public func cornerRadius(_ value: CGFloat) -> Self { 34 | layer.cornerRadius = value 35 | return self 36 | } 37 | 38 | public func cornerRadiusHalf() -> Self { 39 | layer.cornerRadius = frame.height / 2.0 40 | return self 41 | } 42 | 43 | public func border(_ width: CGFloat, _ color: UIColor) -> Self { 44 | layer.borderWidth = width 45 | layer.borderColor = color.cgColor 46 | return self 47 | } 48 | 49 | public func hidden(_ value: Bool) -> Self { 50 | isHidden = value 51 | return self 52 | } 53 | 54 | public func tag(_ value: NSInteger) -> Self { 55 | tag = value 56 | return self 57 | } 58 | 59 | @discardableResult 60 | public func addToView(_ value: UIView) -> Self { 61 | value.addSubview(self) 62 | return self 63 | } 64 | 65 | public func 位置大小(_ 值: CGRect) -> Self { 66 | frame = 值 67 | return self 68 | } 69 | 70 | public func 交互(_ 值: Bool) -> Self { 71 | isUserInteractionEnabled = 值 72 | return self 73 | } 74 | 75 | public func 背景色(_ 值: UIColor) -> Self { 76 | backgroundColor = 值 77 | return self 78 | } 79 | 80 | public func 圆角(_ 值: CGFloat) -> Self { 81 | layer.cornerRadius = 值 82 | return self 83 | } 84 | 85 | public func 半圆角() -> Self { 86 | layer.cornerRadius = frame.height / 2.0 87 | return self 88 | } 89 | 90 | public func 边线(_ 线宽: CGFloat, _ 颜色: UIColor) -> Self { 91 | layer.borderWidth = 线宽 92 | layer.borderColor = 颜色.cgColor 93 | return self 94 | } 95 | 96 | public func 隐藏(_ 值: Bool) -> Self { 97 | isHidden = 值 98 | return self 99 | } 100 | 101 | @discardableResult 102 | public func 添加视图(_ 视图: UIView) -> Self { 103 | self.addSubview(视图) 104 | return self 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /AFUIKit/UIViewController+AFExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+AFExtension.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/8. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | 13 | // 14 | 15 | open var 视图: UIView! { 16 | get { 17 | return view 18 | } 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /AFUIKit/UI视图.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UI视图.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class UI视图: UIView { 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /AFUIKit/UI颜色.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UI颜色.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | 13 | open class var 蓝色: UIColor { 14 | get { 15 | return .blue 16 | } 17 | } 18 | open class var 红色: UIColor { 19 | get { 20 | return .red 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AFUIKit/大小.swift: -------------------------------------------------------------------------------- 1 | // 2 | // 大小.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | 13 | func 大小(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat) -> CGRect { 14 | 15 | return CGRect(x: x, y: y, width: width, height: height) 16 | } 17 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 420013881D61BA1100411A92 /* UITextField+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 420013871D61BA1100411A92 /* UITextField+AFExtension.swift */; }; 11 | 42712D941D5489D6005546E0 /* UIImageView+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42712D931D5489D6005546E0 /* UIImageView+AFExtension.swift */; }; 12 | 42E4D8041D51C6A500752645 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D8031D51C6A500752645 /* AppDelegate.swift */; }; 13 | 42E4D8061D51C6A500752645 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D8051D51C6A500752645 /* ViewController.swift */; }; 14 | 42E4D8091D51C6A500752645 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42E4D8071D51C6A500752645 /* Main.storyboard */; }; 15 | 42E4D80B1D51C6A500752645 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 42E4D80A1D51C6A500752645 /* Assets.xcassets */; }; 16 | 42E4D80E1D51C6A500752645 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42E4D80C1D51C6A500752645 /* LaunchScreen.storyboard */; }; 17 | 42E4D8171D51C78200752645 /* UIView+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D8161D51C78200752645 /* UIView+AFExtension.swift */; }; 18 | 42E4D8191D51CC1100752645 /* UIButton+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D8181D51CC1100752645 /* UIButton+AFExtension.swift */; }; 19 | 42E4D81B1D51DF9600752645 /* UI视图.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D81A1D51DF9600752645 /* UI视图.swift */; }; 20 | 42E4D81D1D51DFF200752645 /* UI颜色.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D81C1D51DFF200752645 /* UI颜色.swift */; }; 21 | 42E4D81F1D51E11900752645 /* 大小.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4D81E1D51E11900752645 /* 大小.swift */; }; 22 | 42EA946C1D63099500D74BCD /* UITextView+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42EA946B1D63099500D74BCD /* UITextView+AFExtension.swift */; }; 23 | 42EBC2331D640A1C001B187C /* NSAttributedString+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42EBC2321D640A1C001B187C /* NSAttributedString+AFExtension.swift */; }; 24 | 42EBC2351D640B43001B187C /* NSMutableAttributedString+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42EBC2341D640B43001B187C /* NSMutableAttributedString+AFExtension.swift */; }; 25 | 42FB2B171D5821BA00BAEE8A /* UIViewController+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FB2B161D5821BA00BAEE8A /* UIViewController+AFExtension.swift */; }; 26 | 42FB2B191D58273300BAEE8A /* UITableViewController+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FB2B181D58273300BAEE8A /* UITableViewController+AFExtension.swift */; }; 27 | 42FB2B1B1D58279700BAEE8A /* UITableView+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FB2B1A1D58279700BAEE8A /* UITableView+AFExtension.swift */; }; 28 | 8F6D0EE21D662EC60019B8C7 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 8F6D0EE11D662EC60019B8C7 /* README.md */; }; 29 | 8F7236011D52614E00121000 /* UILabel+AFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F7236001D52614E00121000 /* UILabel+AFExtension.swift */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 420013871D61BA1100411A92 /* UITextField+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+AFExtension.swift"; sourceTree = ""; }; 34 | 42712D931D5489D6005546E0 /* UIImageView+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+AFExtension.swift"; sourceTree = ""; }; 35 | 42E4D8001D51C6A500752645 /* AFUIKitExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AFUIKitExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 42E4D8031D51C6A500752645 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 42E4D8051D51C6A500752645 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | 42E4D8081D51C6A500752645 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 42E4D80A1D51C6A500752645 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 40 | 42E4D80D1D51C6A500752645 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 41 | 42E4D80F1D51C6A500752645 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 42E4D8161D51C78200752645 /* UIView+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+AFExtension.swift"; sourceTree = ""; }; 43 | 42E4D8181D51CC1100752645 /* UIButton+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+AFExtension.swift"; sourceTree = ""; }; 44 | 42E4D81A1D51DF9600752645 /* UI视图.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UI视图.swift"; sourceTree = ""; }; 45 | 42E4D81C1D51DFF200752645 /* UI颜色.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UI颜色.swift"; sourceTree = ""; }; 46 | 42E4D81E1D51E11900752645 /* 大小.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "大小.swift"; sourceTree = ""; }; 47 | 42EA946B1D63099500D74BCD /* UITextView+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextView+AFExtension.swift"; sourceTree = ""; }; 48 | 42EBC2321D640A1C001B187C /* NSAttributedString+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+AFExtension.swift"; sourceTree = ""; }; 49 | 42EBC2341D640B43001B187C /* NSMutableAttributedString+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+AFExtension.swift"; sourceTree = ""; }; 50 | 42F87A561D9E3A3B00EFF1E5 /* AFExtensionDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFExtensionDefine.h; sourceTree = ""; }; 51 | 42F87A571D9E3A7800EFF1E5 /* AFUIKitExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AFUIKitExample-Bridging-Header.h"; sourceTree = ""; }; 52 | 42FB2B161D5821BA00BAEE8A /* UIViewController+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+AFExtension.swift"; sourceTree = ""; }; 53 | 42FB2B181D58273300BAEE8A /* UITableViewController+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableViewController+AFExtension.swift"; sourceTree = ""; }; 54 | 42FB2B1A1D58279700BAEE8A /* UITableView+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+AFExtension.swift"; sourceTree = ""; }; 55 | 8F6D0EE11D662EC60019B8C7 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 56 | 8F7236001D52614E00121000 /* UILabel+AFExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+AFExtension.swift"; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 42E4D7FD1D51C6A500752645 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 42E4D7F71D51C6A500752645 = { 71 | isa = PBXGroup; 72 | children = ( 73 | 8F6D0EE11D662EC60019B8C7 /* README.md */, 74 | 42E4D8151D51C6ED00752645 /* AFUIKit */, 75 | 42E4D8021D51C6A500752645 /* AFUIKitExample */, 76 | 42E4D8011D51C6A500752645 /* Products */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | 42E4D8011D51C6A500752645 /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 42E4D8001D51C6A500752645 /* AFUIKitExample.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 42E4D8021D51C6A500752645 /* AFUIKitExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 42E4D8031D51C6A500752645 /* AppDelegate.swift */, 92 | 42E4D8051D51C6A500752645 /* ViewController.swift */, 93 | 42E4D8071D51C6A500752645 /* Main.storyboard */, 94 | 42E4D80A1D51C6A500752645 /* Assets.xcassets */, 95 | 42E4D80C1D51C6A500752645 /* LaunchScreen.storyboard */, 96 | 42E4D80F1D51C6A500752645 /* Info.plist */, 97 | ); 98 | path = AFUIKitExample; 99 | sourceTree = ""; 100 | }; 101 | 42E4D8151D51C6ED00752645 /* AFUIKit */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 420013871D61BA1100411A92 /* UITextField+AFExtension.swift */, 105 | 42EA946B1D63099500D74BCD /* UITextView+AFExtension.swift */, 106 | 42E4D8161D51C78200752645 /* UIView+AFExtension.swift */, 107 | 42FB2B1A1D58279700BAEE8A /* UITableView+AFExtension.swift */, 108 | 42FB2B161D5821BA00BAEE8A /* UIViewController+AFExtension.swift */, 109 | 42FB2B181D58273300BAEE8A /* UITableViewController+AFExtension.swift */, 110 | 42E4D8181D51CC1100752645 /* UIButton+AFExtension.swift */, 111 | 8F7236001D52614E00121000 /* UILabel+AFExtension.swift */, 112 | 42712D931D5489D6005546E0 /* UIImageView+AFExtension.swift */, 113 | 8F7236021D52694900121000 /* Just For Fun */, 114 | 42EBC2321D640A1C001B187C /* NSAttributedString+AFExtension.swift */, 115 | 42EBC2341D640B43001B187C /* NSMutableAttributedString+AFExtension.swift */, 116 | 42F87A561D9E3A3B00EFF1E5 /* AFExtensionDefine.h */, 117 | 42F87A571D9E3A7800EFF1E5 /* AFUIKitExample-Bridging-Header.h */, 118 | ); 119 | name = AFUIKit; 120 | path = ../AFUIKit; 121 | sourceTree = ""; 122 | }; 123 | 8F7236021D52694900121000 /* Just For Fun */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 42E4D81A1D51DF9600752645 /* UI视图.swift */, 127 | 42E4D81C1D51DFF200752645 /* UI颜色.swift */, 128 | 42E4D81E1D51E11900752645 /* 大小.swift */, 129 | ); 130 | name = "Just For Fun"; 131 | sourceTree = ""; 132 | }; 133 | /* End PBXGroup section */ 134 | 135 | /* Begin PBXNativeTarget section */ 136 | 42E4D7FF1D51C6A500752645 /* AFUIKitExample */ = { 137 | isa = PBXNativeTarget; 138 | buildConfigurationList = 42E4D8121D51C6A500752645 /* Build configuration list for PBXNativeTarget "AFUIKitExample" */; 139 | buildPhases = ( 140 | 42E4D7FC1D51C6A500752645 /* Sources */, 141 | 42E4D7FD1D51C6A500752645 /* Frameworks */, 142 | 42E4D7FE1D51C6A500752645 /* Resources */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = AFUIKitExample; 149 | productName = AFUIKitExample; 150 | productReference = 42E4D8001D51C6A500752645 /* AFUIKitExample.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 42E4D7F81D51C6A500752645 /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastSwiftUpdateCheck = 0730; 160 | LastUpgradeCheck = 0800; 161 | ORGANIZATIONNAME = Afer; 162 | TargetAttributes = { 163 | 42E4D7FF1D51C6A500752645 = { 164 | CreatedOnToolsVersion = 7.3; 165 | DevelopmentTeam = XV5TGH8D5H; 166 | LastSwiftMigration = 0800; 167 | }; 168 | }; 169 | }; 170 | buildConfigurationList = 42E4D7FB1D51C6A500752645 /* Build configuration list for PBXProject "AFUIKitExample" */; 171 | compatibilityVersion = "Xcode 3.2"; 172 | developmentRegion = English; 173 | hasScannedForEncodings = 0; 174 | knownRegions = ( 175 | en, 176 | Base, 177 | ); 178 | mainGroup = 42E4D7F71D51C6A500752645; 179 | productRefGroup = 42E4D8011D51C6A500752645 /* Products */; 180 | projectDirPath = ""; 181 | projectRoot = ""; 182 | targets = ( 183 | 42E4D7FF1D51C6A500752645 /* AFUIKitExample */, 184 | ); 185 | }; 186 | /* End PBXProject section */ 187 | 188 | /* Begin PBXResourcesBuildPhase section */ 189 | 42E4D7FE1D51C6A500752645 /* Resources */ = { 190 | isa = PBXResourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 42E4D80E1D51C6A500752645 /* LaunchScreen.storyboard in Resources */, 194 | 42E4D80B1D51C6A500752645 /* Assets.xcassets in Resources */, 195 | 42E4D8091D51C6A500752645 /* Main.storyboard in Resources */, 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | }; 199 | /* End PBXResourcesBuildPhase section */ 200 | 201 | /* Begin PBXSourcesBuildPhase section */ 202 | 42E4D7FC1D51C6A500752645 /* Sources */ = { 203 | isa = PBXSourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | 42EA946C1D63099500D74BCD /* UITextView+AFExtension.swift in Sources */, 207 | 42E4D8061D51C6A500752645 /* ViewController.swift in Sources */, 208 | 8F7236011D52614E00121000 /* UILabel+AFExtension.swift in Sources */, 209 | 42EBC2331D640A1C001B187C /* NSAttributedString+AFExtension.swift in Sources */, 210 | 42E4D81B1D51DF9600752645 /* UI视图.swift in Sources */, 211 | 42E4D8171D51C78200752645 /* UIView+AFExtension.swift in Sources */, 212 | 42FB2B1B1D58279700BAEE8A /* UITableView+AFExtension.swift in Sources */, 213 | 42FB2B191D58273300BAEE8A /* UITableViewController+AFExtension.swift in Sources */, 214 | 42E4D81D1D51DFF200752645 /* UI颜色.swift in Sources */, 215 | 42E4D81F1D51E11900752645 /* 大小.swift in Sources */, 216 | 42712D941D5489D6005546E0 /* UIImageView+AFExtension.swift in Sources */, 217 | 8F6D0EE21D662EC60019B8C7 /* README.md in Sources */, 218 | 42E4D8191D51CC1100752645 /* UIButton+AFExtension.swift in Sources */, 219 | 42E4D8041D51C6A500752645 /* AppDelegate.swift in Sources */, 220 | 420013881D61BA1100411A92 /* UITextField+AFExtension.swift in Sources */, 221 | 42FB2B171D5821BA00BAEE8A /* UIViewController+AFExtension.swift in Sources */, 222 | 42EBC2351D640B43001B187C /* NSMutableAttributedString+AFExtension.swift in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXSourcesBuildPhase section */ 227 | 228 | /* Begin PBXVariantGroup section */ 229 | 42E4D8071D51C6A500752645 /* Main.storyboard */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | 42E4D8081D51C6A500752645 /* Base */, 233 | ); 234 | name = Main.storyboard; 235 | sourceTree = ""; 236 | }; 237 | 42E4D80C1D51C6A500752645 /* LaunchScreen.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 42E4D80D1D51C6A500752645 /* Base */, 241 | ); 242 | name = LaunchScreen.storyboard; 243 | sourceTree = ""; 244 | }; 245 | /* End PBXVariantGroup section */ 246 | 247 | /* Begin XCBuildConfiguration section */ 248 | 42E4D8101D51C6A500752645 /* Debug */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 254 | CLANG_CXX_LIBRARY = "libc++"; 255 | CLANG_ENABLE_MODULES = YES; 256 | CLANG_ENABLE_OBJC_ARC = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_CONSTANT_CONVERSION = YES; 259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INFINITE_RECURSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 266 | CLANG_WARN_UNREACHABLE_CODE = YES; 267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 268 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 269 | COPY_PHASE_STRIP = NO; 270 | DEBUG_INFORMATION_FORMAT = dwarf; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | ENABLE_TESTABILITY = YES; 273 | GCC_C_LANGUAGE_STANDARD = gnu99; 274 | GCC_DYNAMIC_NO_PIC = NO; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 288 | MTL_ENABLE_DEBUG_INFO = YES; 289 | ONLY_ACTIVE_ARCH = YES; 290 | SDKROOT = iphoneos; 291 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 292 | }; 293 | name = Debug; 294 | }; 295 | 42E4D8111D51C6A500752645 /* Release */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ALWAYS_SEARCH_USER_PATHS = NO; 299 | CLANG_ANALYZER_NONNULL = YES; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 301 | CLANG_CXX_LIBRARY = "libc++"; 302 | CLANG_ENABLE_MODULES = YES; 303 | CLANG_ENABLE_OBJC_ARC = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INFINITE_RECURSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 313 | CLANG_WARN_UNREACHABLE_CODE = YES; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 316 | COPY_PHASE_STRIP = NO; 317 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 318 | ENABLE_NS_ASSERTIONS = NO; 319 | ENABLE_STRICT_OBJC_MSGSEND = YES; 320 | GCC_C_LANGUAGE_STANDARD = gnu99; 321 | GCC_NO_COMMON_BLOCKS = YES; 322 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 323 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 324 | GCC_WARN_UNDECLARED_SELECTOR = YES; 325 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 326 | GCC_WARN_UNUSED_FUNCTION = YES; 327 | GCC_WARN_UNUSED_VARIABLE = YES; 328 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 329 | MTL_ENABLE_DEBUG_INFO = NO; 330 | SDKROOT = iphoneos; 331 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 332 | VALIDATE_PRODUCT = YES; 333 | }; 334 | name = Release; 335 | }; 336 | 42E4D8131D51C6A500752645 /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 340 | CLANG_ENABLE_MODULES = YES; 341 | DEVELOPMENT_TEAM = XV5TGH8D5H; 342 | INFOPLIST_FILE = AFUIKitExample/Info.plist; 343 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 344 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 345 | PRODUCT_BUNDLE_IDENTIFIER = com.8888; 346 | PRODUCT_NAME = "$(TARGET_NAME)"; 347 | SWIFT_OBJC_BRIDGING_HEADER = "../AFUIKit/AFUIKitExample-Bridging-Header.h"; 348 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 349 | SWIFT_VERSION = 3.0; 350 | }; 351 | name = Debug; 352 | }; 353 | 42E4D8141D51C6A500752645 /* Release */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | CLANG_ENABLE_MODULES = YES; 358 | DEVELOPMENT_TEAM = XV5TGH8D5H; 359 | INFOPLIST_FILE = AFUIKitExample/Info.plist; 360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 362 | PRODUCT_BUNDLE_IDENTIFIER = com.8888; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | SWIFT_OBJC_BRIDGING_HEADER = "../AFUIKit/AFUIKitExample-Bridging-Header.h"; 365 | SWIFT_VERSION = 3.0; 366 | }; 367 | name = Release; 368 | }; 369 | /* End XCBuildConfiguration section */ 370 | 371 | /* Begin XCConfigurationList section */ 372 | 42E4D7FB1D51C6A500752645 /* Build configuration list for PBXProject "AFUIKitExample" */ = { 373 | isa = XCConfigurationList; 374 | buildConfigurations = ( 375 | 42E4D8101D51C6A500752645 /* Debug */, 376 | 42E4D8111D51C6A500752645 /* Release */, 377 | ); 378 | defaultConfigurationIsVisible = 0; 379 | defaultConfigurationName = Release; 380 | }; 381 | 42E4D8121D51C6A500752645 /* Build configuration list for PBXNativeTarget "AFUIKitExample" */ = { 382 | isa = XCConfigurationList; 383 | buildConfigurations = ( 384 | 42E4D8131D51C6A500752645 /* Debug */, 385 | 42E4D8141D51C6A500752645 /* Release */, 386 | ); 387 | defaultConfigurationIsVisible = 0; 388 | defaultConfigurationName = Release; 389 | }; 390 | /* End XCConfigurationList section */ 391 | }; 392 | rootObject = 42E4D7F81D51C6A500752645 /* Project object */; 393 | } 394 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/project.xcworkspace/xcuserdata/koudaiwang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myafer/AFUIKit/5feaa4e85cfdb0e8f1c9f8b6cd311993193f98af/AFUIKitExample/AFUIKitExample.xcodeproj/project.xcworkspace/xcuserdata/koudaiwang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/project.xcworkspace/xcuserdata/yihui.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myafer/AFUIKit/5feaa4e85cfdb0e8f1c9f8b6cd311993193f98af/AFUIKitExample/AFUIKitExample.xcodeproj/project.xcworkspace/xcuserdata/yihui.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/koudaiwang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/koudaiwang.xcuserdatad/xcschemes/AFUIKitExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/koudaiwang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFUIKitExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 42E4D7FF1D51C6A500752645 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/yihui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/yihui.xcuserdatad/xcschemes/AFUIKitExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample.xcodeproj/xcuserdata/yihui.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFUIKitExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 42E4D7FF1D51C6A500752645 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | return true 19 | } 20 | 21 | 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/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 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/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 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /AFUIKitExample/AFUIKitExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // AFUIKitExample 4 | // 5 | // Created by 口贷网 on 16/8/3. 6 | // Copyright © 2016年 Afer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | 13 | class ViewController: UIViewController { 14 | 15 | 16 | lazy var btn: UIButton = { 17 | 18 | return UIButton() 19 | .frame(CGRect(x: 100, y: 60, width: 100, height: 40)) 20 | .bgColor(.red) 21 | .cornerRadiusHalf() 22 | .border(2, .blue) 23 | .hidden(false) 24 | .title("一般", state: .normal) 25 | .selectedStateTitle("选中") 26 | .highlightedStateTitle("高亮") 27 | .hidden(false) 28 | .bgColor(.black) 29 | .tag(11) 30 | .target(self, action: #selector(ViewController.test(_:)), forControlEvents: .touchUpInside) 31 | }() 32 | 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | 37 | UIButton() 38 | .frame(CGRect(x: 100, y: 60, width: 100, height: 40)) 39 | .bgColor( .red) 40 | .cornerRadiusHalf() 41 | .border(2, UIColor.blue) 42 | .hidden(false) 43 | .title("一般", state: .normal) 44 | .selectedStateTitle("选中") 45 | .highlightedStateTitle("高亮") 46 | .hidden(false) 47 | .bgColor(.black) 48 | .tag(11) 49 | .target(self, action: #selector(ViewController.test(_:)), forControlEvents: UIControlEvents.touchUpInside) 50 | .addToView(self.view) 51 | 52 | 53 | 54 | let attr = NSMutableAttributedString() 55 | .append_attr("123", [AFFontColor: UIColor.red]) 56 | .append_attr("456", [AFFontColor: UIColor.blue]) 57 | .append_attr("3333", [AFBgColor: UIColor.red]) 58 | 59 | let label = UILabel() 60 | .frame(CGRect(x: 10, y: 300, width: 100, height: 50)) 61 | .cornerRadiusHalf() 62 | .bgColor( .purple) 63 | .text("Lable") 64 | .textAlignment(.center) 65 | .attributedText(attr) 66 | self.view.addSubview(label) 67 | 68 | 69 | // // Just for fun 70 | let 视图 = UI视图() 71 | .位置大小(大小(100, 100, 100, 100)) 72 | .背景色(.红色) 73 | .圆角(30) 74 | .边线(1, .蓝色) 75 | 76 | 77 | self.视图.添加视图(视图) 78 | 79 | let btn1 = UIButton() 80 | btn1.frame = CGRect(x: 100, y: 200, width: 100, height: 40) 81 | btn1.backgroundColor = UIColor.red 82 | btn1.layer.cornerRadius = btn1.frame.height / 2.0 83 | btn1.layer.borderColor = UIColor.blue.cgColor 84 | btn1.layer.borderWidth = 2.0 85 | btn1.isHidden = false 86 | btn1.setTitle("一般", for: UIControlState.normal) 87 | btn1.setTitle("选中", for: UIControlState.selected) 88 | btn1.setTitle("高亮", for: UIControlState.highlighted) 89 | btn1.addTarget(self, action: #selector(ViewController.test(_:)), for: UIControlEvents.touchUpInside) 90 | self.view.addSubview(btn1) 91 | 92 | } 93 | 94 | 95 | func test(_ sender: UIButton) { 96 | sender.isSelected = !sender.isSelected 97 | } 98 | 99 | 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /AFUIKitExample/README.md: -------------------------------------------------------------------------------- 1 | # AFUIKit 2 | 3 | UI库的链式调用,减少UI控件代码量。 4 | 此库比较简单,欢迎大家PR.. 5 | 6 | --- 7 | 8 | ![code](https://raw.githubusercontent.com/myafer/AFUIKit/master/code.png) 9 | 10 | pod install 11 | 12 | `pod 'AFUIKit'` 13 | 14 | --- 15 | 16 | 17 | 18 | ` 19 | // 库的写法 20 | UIButton() 21 | .frame(CGRectMake(100, 60, 100, 40)) 22 | .bgColor(.redColor()) 23 | .cornerRadiusHalf() 24 | .border(2, color: UIColor.blueColor()) 25 | .hidden(false) 26 | .title("一般", state: .Normal) 27 | .selectedStateTitle("选中") 28 | .highlightedStateTitle("高亮") 29 | .hidden(false) 30 | .bgColor(.blackColor()) 31 | .tag(11) 32 | .target(self, action: #selector(ViewController.test(_:)), forControlEvents: UIControlEvents.TouchUpInside) 33 | .addToView(self.view) 34 | 35 | // 原生写法 36 | let btn1 = UIButton() 37 | btn1.frame = CGRectMake(100, 200, 100, 40) 38 | btn1.backgroundColor = UIColor.redColor() 39 | btn1.layer.cornerRadius = btn1.frame.height / 2.0 40 | btn1.layer.borderColor = UIColor.blueColor().CGColor 41 | btn1.layer.borderWidth = 2.0 42 | btn1.hidden = false 43 | btn1.setTitle("一般", forState: UIControlState.Normal) 44 | btn1.setTitle("选中", forState: UIControlState.Selected) 45 | btn1.setTitle("高亮", forState: UIControlState.Highlighted) 46 | btn1.addTarget(self, action: #selector(ViewController.test(_:)), forControlEvents: UIControlEvents.TouchUpInside) 47 | self.view.addSubview(btn1) 48 | 49 | 50 | ` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 codester 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 | # AFUIKit 2 | 3 | UI库的链式调用,减少UI控件代码量。 4 | 此库比较简单,欢迎大家PR. 5 | 6 | --- 7 | 8 | ![code](https://raw.githubusercontent.com/myafer/AFUIKit/master/code.png) 9 | 10 | pod install 11 | 12 | `pod 'AFUIKit'` -------------------------------------------------------------------------------- /code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myafer/AFUIKit/5feaa4e85cfdb0e8f1c9f8b6cd311993193f98af/code.png -------------------------------------------------------------------------------- /任务清单.numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myafer/AFUIKit/5feaa4e85cfdb0e8f1c9f8b6cd311993193f98af/任务清单.numbers --------------------------------------------------------------------------------