Repository: aloco/SimpleButton Branch: master Commit: ae7b44515223 Files: 97 Total size: 813.9 KB Directory structure: gitextract_06_t_g1y/ ├── .gitignore ├── .travis.yml ├── Example/ │ ├── AppDelegate.swift │ ├── Base.lproj/ │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CustomButtons.swift │ ├── DesignableButton.swift │ ├── Images.xcassets/ │ │ ├── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── garten.imageset/ │ │ └── Contents.json │ ├── Info.plist │ ├── UIColorExtensions.swift │ └── ViewController.swift ├── Example.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata/ │ └── xcschemes/ │ ├── SimpleButton.xcscheme │ └── SimpleButtonTests.xcscheme ├── LICENSE ├── Package.swift ├── README.md ├── SimpleButton/ │ ├── Info.plist │ ├── SimpleButton.h │ ├── SimpleButton.swift │ ├── SimpleButtonControlState.swift │ └── SimpleButtonStateChangeValue.swift ├── SimpleButton.podspec ├── SimpleButtonTests/ │ ├── Info.plist │ └── SimpleButtonTests.swift └── docs/ ├── Classes/ │ └── SimpleButton.html ├── Classes.html ├── Structs/ │ └── SimpleButtonControlState.html ├── Structs.html ├── css/ │ ├── highlight.css │ └── jazzy.css ├── docsets/ │ ├── SimpleButton.docset/ │ │ └── Contents/ │ │ ├── Info.plist │ │ └── Resources/ │ │ ├── Documents/ │ │ │ ├── Classes/ │ │ │ │ └── SimpleButton.html │ │ │ ├── Classes.html │ │ │ ├── Structs/ │ │ │ │ └── SimpleButtonControlState.html │ │ │ ├── Structs.html │ │ │ ├── css/ │ │ │ │ ├── highlight.css │ │ │ │ └── jazzy.css │ │ │ ├── index.html │ │ │ ├── js/ │ │ │ │ └── jazzy.js │ │ │ ├── search.json │ │ │ └── swift_output/ │ │ │ ├── Classes/ │ │ │ │ └── SimpleButton.html │ │ │ ├── Classes.html │ │ │ ├── Structs/ │ │ │ │ └── SimpleButtonControlState.html │ │ │ ├── Structs.html │ │ │ ├── css/ │ │ │ │ ├── highlight.css │ │ │ │ └── jazzy.css │ │ │ ├── docsets/ │ │ │ │ ├── SimpleButton.docset/ │ │ │ │ │ └── Contents/ │ │ │ │ │ ├── Info.plist │ │ │ │ │ └── Resources/ │ │ │ │ │ ├── Documents/ │ │ │ │ │ │ ├── Classes/ │ │ │ │ │ │ │ └── SimpleButton.html │ │ │ │ │ │ ├── Classes.html │ │ │ │ │ │ ├── Structs/ │ │ │ │ │ │ │ └── SimpleButtonControlState.html │ │ │ │ │ │ ├── Structs.html │ │ │ │ │ │ ├── css/ │ │ │ │ │ │ │ ├── highlight.css │ │ │ │ │ │ │ └── jazzy.css │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ ├── js/ │ │ │ │ │ │ │ └── jazzy.js │ │ │ │ │ │ └── search.json │ │ │ │ │ └── docSet.dsidx │ │ │ │ ├── SimpleButton.tgz │ │ │ │ └── SimpleButton.xml │ │ │ ├── index.html │ │ │ ├── js/ │ │ │ │ └── jazzy.js │ │ │ ├── search.json │ │ │ └── undocumented.json │ │ └── docSet.dsidx │ └── SimpleButton.tgz ├── index.html ├── js/ │ └── jazzy.js ├── search.json ├── swift_output/ │ ├── Classes/ │ │ └── SimpleButton.html │ ├── Classes.html │ ├── Structs/ │ │ └── SimpleButtonControlState.html │ ├── Structs.html │ ├── css/ │ │ ├── highlight.css │ │ └── jazzy.css │ ├── docsets/ │ │ ├── SimpleButton.docset/ │ │ │ └── Contents/ │ │ │ ├── Info.plist │ │ │ └── Resources/ │ │ │ ├── Documents/ │ │ │ │ ├── Classes/ │ │ │ │ │ └── SimpleButton.html │ │ │ │ ├── Classes.html │ │ │ │ ├── Structs/ │ │ │ │ │ └── SimpleButtonControlState.html │ │ │ │ ├── Structs.html │ │ │ │ ├── css/ │ │ │ │ │ ├── highlight.css │ │ │ │ │ └── jazzy.css │ │ │ │ ├── index.html │ │ │ │ ├── js/ │ │ │ │ │ └── jazzy.js │ │ │ │ └── search.json │ │ │ └── docSet.dsidx │ │ ├── SimpleButton.tgz │ │ └── SimpleButton.xml │ ├── index.html │ ├── js/ │ │ └── jazzy.js │ ├── search.json │ └── undocumented.json └── undocumented.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode # build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate .DS_Store # Swift Package Manager .build/ ================================================ FILE: .travis.yml ================================================ language: objective-c osx_image: xcode10 script: # The pipefail option sets the exit status to the last commond with a non-zero status code, which would usually be xcodebuild - set -o pipefail && xcodebuild test -project Example.xcodeproj -scheme SimpleButtonTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone x,OS=latest" | xcpretty ================================================ FILE: Example/AppDelegate.swift ================================================ // // AppDelegate.swift // Example // // Created by Andreas Tinoco Lobo on 25.03.15. // Copyright (c) 2015 Andreas Tinoco Lobo. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // 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. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // 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. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // 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. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: Example/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: Example/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Example/CustomButtons.swift ================================================ // // CustomButtons.swift // Example // // Created by Andreas Tinoco Lobo on 08.04.15. // Copyright (c) 2015 Andreas Tinoco Lobo. All rights reserved. // import Foundation import SimpleButton class ScaleButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.peterRiverColor(), for: .normal) setTitle("SCALE", for: .normal) setScale(1.0, for: .normal, animated: true, animationDuration: 0.25) setScale(0.96, for: .highlighted, animated: true, animationDuration: 0.1) } } class BackgroundColorButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.peterRiverColor(), for: .normal, animated: true, animationDuration: 0.2) setBackgroundColor(UIColor.belizeHoleColor(), for: .highlighted, animated: false) setBackgroundColor(UIColor.nephritisColor(), for: SimpleButtonControlState.loading) setTitle("BACKGROUND COLOR", for: .normal) } } class BorderWidthButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.alizarinColor(), for: .normal, animated: true) setBorderColor(UIColor.pomergranateColor(), for: .normal, animated: true) setTitle("BORDER WIDTH", for: .normal) setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2) setBorderWidth(8.0, for: .highlighted, animated: false) } } class BorderColorButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setTitleColor(UIColor.alizarinColor(), for: .normal) setTitleColor(UIColor.pomergranateColor(), for: .highlighted) setBorderWidth(6.0, for: .normal) setBorderColor(UIColor.alizarinColor(), for: .normal, animationDuration: 0.3) setBorderColor(UIColor.pomergranateColor(), for: .highlighted, animated: false) setTitle("BORDER COLOR", for: .normal) } } class CornerRadiusButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.peterRiverColor(), for: .normal, animated: true) setTitle("RADIUS", for: .normal) setCornerRadius(10.0, for: .normal, animated: true) setCornerRadius(30.0, for: .highlighted, animated: true) } } class ShadowButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setShadowRadius(10, for: .normal, animated: true) setShadowRadius(3, for: .highlighted, animated: true) setBackgroundColor(UIColor.alizarinColor(), for: .normal, animated: true) setShadowColor(UIColor.asbestosColor(), for: .normal) setShadowOpacity(1.0, for: .normal, animated: true) setShadowOffset(CGSize(width: 0, height: 0), for: .normal, animated: true) setTitle("SHADOW", for: .normal) } } class LoadingButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.peterRiverColor(), for: .normal) setBackgroundColor(UIColor.belizeHoleColor(), for: .highlighted) setBackgroundColor(UIColor.asbestosColor(), for: SimpleButtonControlState.loading) loadingView = createCustomLoadingView() setTitleColor(UIColor.white, for: .normal) setTitle("PRESS TO START LOADING", for: .normal) } private func createCustomLoadingView() -> UIView { let view = UIView() let imageView = UIImageView(image: UIImage(named: "garten")) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false imageView.heightAnchor.constraint(equalToConstant: 40).isActive = true imageView.contentMode = .scaleAspectFit imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true view.backgroundColor = .red return view } } class DisabledButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBackgroundColor(UIColor.alizarinColor(), for: .normal) setBackgroundColor(UIColor.pomergranateColor(), for: .highlighted) setTitle("PRESS TO DISABLE BUTTON", for: .normal) setTitle("BUTTON DISABLED", for: .disabled) setBackgroundColor(UIColor.silverColor(), for: .disabled) setTitleColor(UIColor.white, for: .normal) } } ================================================ FILE: Example/DesignableButton.swift ================================================ // // DesignableButton.swift // Example // // Created by Gunter Hager on 03.06.16. // Copyright © 2016 all about apps. All rights reserved. // import UIKit import SimpleButton @IBDesignable class DesignableButton: SimpleButton { /// Background color for normal state. @IBInspectable var backgroundColorNormal: UIColor? @IBInspectable var backgroundColorHighlight: UIColor? @IBInspectable var titleColorNormal: UIColor? @IBInspectable var titleColorHighlighted: UIColor? @IBInspectable var shadow: Bool = false @IBInspectable var shadowColor: UIColor? @IBInspectable var shadowOffset: CGSize = CGSize.zero @IBInspectable var shadowRadius: CGFloat = 0 @IBInspectable var shadowOpacity: Float = 0 override func configureButtonStyles() { super.configureButtonStyles() if let backgroundColorNormal = backgroundColorNormal { setBackgroundColor(backgroundColorNormal, for: .normal) } if let backgroundColorHighlight = backgroundColorHighlight { setBackgroundColor(backgroundColorHighlight, for: .highlighted) } if let titleColorNormal = titleColorNormal { setTitleColor(titleColorNormal, for: .normal) } if let titleColorHighlighted = titleColorHighlighted { setTitleColor(titleColorHighlighted, for: .highlighted) } if shadow { if let shadowColor = shadowColor { setShadowColor(shadowColor) } setShadowOffset(shadowOffset) setShadowRadius(shadowRadius) setShadowOpacity(shadowOpacity) } } } ================================================ FILE: Example/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20x20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "1x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "2x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" }, { "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" }, { "idiom" : "ios-marketing", "size" : "1024x1024", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/Images.xcassets/Contents.json ================================================ { "info" : { "author" : "xcode", "version" : 1 } } ================================================ FILE: Example/Images.xcassets/garten.imageset/Contents.json ================================================ { "images" : [ { "filename" : "garten.png", "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } ================================================ FILE: Example/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 4.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Example/UIColorExtensions.swift ================================================ // // UIColorExtensions.swift // // Created by Mihails Tumkins on 10/02/15. // import UIKit extension UIColor { convenience init(r: Int, g:Int, b:Int) { self.init(red: CGFloat(r)/255, green: CGFloat(g)/255, blue: CGFloat(b)/255, alpha: 1.0) } class func turquoiseColor()->UIColor { return UIColor(r: 26, g: 188, b: 156) } class func greenSeaColor()->UIColor { return UIColor(r: 22, g: 160, b: 133) } class func emeraldColor()->UIColor { return UIColor(r: 46, g: 204, b: 113) } class func nephritisColor()->UIColor { return UIColor(r: 39, g: 174, b: 96) } class func peterRiverColor()->UIColor { return UIColor(r: 52, g: 152, b: 219) } class func belizeHoleColor()->UIColor { return UIColor(r: 41, g: 128, b: 185) } class func amethystColor()->UIColor { return UIColor(r:155, g:89, b:182) } class func wisteriaColor()->UIColor { return UIColor(r:142, g:68, b:173) } class func wetAsphaltColor()->UIColor { return UIColor(r:52, g:73, b:94) } class func midnightBlueColor()->UIColor { return UIColor(r:44, g:62, b:80) } class func sunflowerColor()->UIColor { return UIColor(r:241, g:196, b:15) } class func carrotColor()->UIColor { return UIColor(r:230, g:126, b:34) } class func pumpkinColor()->UIColor { return UIColor(r:211, g:84, b:0) } class func alizarinColor()->UIColor { return UIColor(r:231, g:76, b:60) } class func pomergranateColor()->UIColor { return UIColor(r:192, g:57, b:43) } class func cloudsColor()->UIColor { return UIColor(r:236, g:240, b:241) } class func silverColor()->UIColor { return UIColor(r:189, g:195, b:199) } class func concreteColor()->UIColor { return UIColor(r:149, g:165, b:166) } class func asbestosColor()->UIColor { return UIColor(r:127, g:140, b:141) } } ================================================ FILE: Example/ViewController.swift ================================================ // // ViewController.swift // Example // // Created by Andreas Tinoco Lobo on 12/11/15. // Copyright © 2015 Andreas Tinoco Lobo. All rights reserved. // import UIKit import SimpleButton class ViewController: UIViewController { @IBOutlet weak var saveButton: LoadingButton! @IBOutlet weak var disabledButton: DisabledButton! override func viewDidLoad() { super.viewDidLoad() // create SimpleButton from code } @IBAction func disabledButtonTouchUpInside(_ sender: AnyObject) { disabledButton.isEnabled = false // Delay execution of my block for 3 seconds. DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(UInt64(3) * NSEC_PER_SEC)) / Double(NSEC_PER_SEC)) { self.disabledButton.isEnabled = true } } @IBAction func saveButtonTouchUpInside(_ sender: AnyObject) { saveButton.isLoading = true // Delay execution of my block for 3 seconds. DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(UInt64(3) * NSEC_PER_SEC)) / Double(NSEC_PER_SEC)) { self.saveButton.isLoading = false } } } ================================================ FILE: Example.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 1FE0BCDE1BD6845400C9E8F6 /* SimpleButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */; }; 4D032EE31ADD85C600991630 /* SimpleButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D032EE21ADD85C600991630 /* SimpleButtonTests.swift */; }; A92045E61AD5803900401655 /* CustomButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = A92045E51AD5803900401655 /* CustomButtons.swift */; }; A93CA2531AC2B89300BD5B22 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93CA2521AC2B89300BD5B22 /* AppDelegate.swift */; }; A93CA25A1AC2B89300BD5B22 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A93CA2591AC2B89300BD5B22 /* Images.xcassets */; }; A93CA25D1AC2B89300BD5B22 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93CA25B1AC2B89300BD5B22 /* LaunchScreen.xib */; }; A93CA27C1AC2B8A800BD5B22 /* SimpleButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A93CA27B1AC2B8A800BD5B22 /* SimpleButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; A93CA28E1AC2B8A900BD5B22 /* SimpleButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */; }; A93CA28F1AC2B8A900BD5B22 /* SimpleButton.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; A93CA2981AC2B91400BD5B22 /* SimpleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93CA2971AC2B91400BD5B22 /* SimpleButton.swift */; }; A93DE0DE1BE8E20F00409A4B /* SimpleButtonControlState.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93DE0DD1BE8E20F00409A4B /* SimpleButtonControlState.swift */; }; A93DE0E01BE90C8200409A4B /* SimpleButtonStateChangeValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93DE0DF1BE90C8200409A4B /* SimpleButtonStateChangeValue.swift */; }; A97727951C04B3E400FDC7B4 /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97727941C04B3E400FDC7B4 /* UIColorExtensions.swift */; }; A98449251BF4B991007E90C7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98449241BF4B991007E90C7 /* ViewController.swift */; }; A9C97EEE1AC45CCF005C14E0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9C97EEC1AC45CCF005C14E0 /* Main.storyboard */; }; BC95C8DB1D01790C00BC474C /* DesignableButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC95C8DA1D01790C00BC474C /* DesignableButton.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 4D032EDD1ADD858E00991630 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A93CA2451AC2B89300BD5B22 /* Project object */; proxyType = 1; remoteGlobalIDString = A93CA2761AC2B8A800BD5B22; remoteInfo = SimpleButton; }; A93CA28C1AC2B8A900BD5B22 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A93CA2451AC2B89300BD5B22 /* Project object */; proxyType = 1; remoteGlobalIDString = A93CA2761AC2B8A800BD5B22; remoteInfo = SimpleButton; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ A93CA2931AC2B8A900BD5B22 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( A93CA28F1AC2B8A900BD5B22 /* SimpleButton.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 1FBF39581BD678AD00289AAD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4D032ED61ADD858E00991630 /* SimpleButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 4D032EE21ADD85C600991630 /* SimpleButtonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleButtonTests.swift; sourceTree = ""; }; A92045E51AD5803900401655 /* CustomButtons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomButtons.swift; sourceTree = ""; }; A93CA24D1AC2B89300BD5B22 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; A93CA2511AC2B89300BD5B22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A93CA2521AC2B89300BD5B22 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; A93CA2591AC2B89300BD5B22 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; A93CA25C1AC2B89300BD5B22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SimpleButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A93CA27A1AC2B8A800BD5B22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A93CA27B1AC2B8A800BD5B22 /* SimpleButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleButton.h; sourceTree = ""; }; A93CA2971AC2B91400BD5B22 /* SimpleButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleButton.swift; sourceTree = ""; }; A93DE0DD1BE8E20F00409A4B /* SimpleButtonControlState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleButtonControlState.swift; sourceTree = ""; }; A93DE0DF1BE90C8200409A4B /* SimpleButtonStateChangeValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleButtonStateChangeValue.swift; sourceTree = ""; }; A97727941C04B3E400FDC7B4 /* UIColorExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColorExtensions.swift; sourceTree = ""; }; A98449241BF4B991007E90C7 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; A9C97EED1AC45CCF005C14E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; BC95C8DA1D01790C00BC474C /* DesignableButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DesignableButton.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 4D032ED31ADD858E00991630 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 1FE0BCDE1BD6845400C9E8F6 /* SimpleButton.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; A93CA24A1AC2B89300BD5B22 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A93CA28E1AC2B8A900BD5B22 /* SimpleButton.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; A93CA2731AC2B8A800BD5B22 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 4D032EBF1ADD84C800991630 /* Custom Button Classes */ = { isa = PBXGroup; children = ( A92045E51AD5803900401655 /* CustomButtons.swift */, BC95C8DA1D01790C00BC474C /* DesignableButton.swift */, ); name = "Custom Button Classes"; sourceTree = ""; }; 4D032ED71ADD858E00991630 /* SimpleButtonTests */ = { isa = PBXGroup; children = ( 4D032EE21ADD85C600991630 /* SimpleButtonTests.swift */, 4D032ED81ADD858E00991630 /* Supporting Files */, ); path = SimpleButtonTests; sourceTree = ""; }; 4D032ED81ADD858E00991630 /* Supporting Files */ = { isa = PBXGroup; children = ( 1FBF39581BD678AD00289AAD /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; A93CA2441AC2B89300BD5B22 = { isa = PBXGroup; children = ( A93CA24F1AC2B89300BD5B22 /* Example */, A93CA2781AC2B8A800BD5B22 /* SimpleButton */, 4D032ED71ADD858E00991630 /* SimpleButtonTests */, A93CA24E1AC2B89300BD5B22 /* Products */, ); sourceTree = ""; }; A93CA24E1AC2B89300BD5B22 /* Products */ = { isa = PBXGroup; children = ( A93CA24D1AC2B89300BD5B22 /* Example.app */, A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */, 4D032ED61ADD858E00991630 /* SimpleButtonTests.xctest */, ); name = Products; sourceTree = ""; }; A93CA24F1AC2B89300BD5B22 /* Example */ = { isa = PBXGroup; children = ( A93CA2521AC2B89300BD5B22 /* AppDelegate.swift */, A98449241BF4B991007E90C7 /* ViewController.swift */, A9C97EEC1AC45CCF005C14E0 /* Main.storyboard */, 4D032EBF1ADD84C800991630 /* Custom Button Classes */, A93CA2501AC2B89300BD5B22 /* Supporting Files */, A93CA2591AC2B89300BD5B22 /* Images.xcassets */, A93CA25B1AC2B89300BD5B22 /* LaunchScreen.xib */, A97727941C04B3E400FDC7B4 /* UIColorExtensions.swift */, ); path = Example; sourceTree = ""; }; A93CA2501AC2B89300BD5B22 /* Supporting Files */ = { isa = PBXGroup; children = ( A93CA2511AC2B89300BD5B22 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; A93CA2781AC2B8A800BD5B22 /* SimpleButton */ = { isa = PBXGroup; children = ( A93CA2971AC2B91400BD5B22 /* SimpleButton.swift */, A93DE0DD1BE8E20F00409A4B /* SimpleButtonControlState.swift */, A93CA27B1AC2B8A800BD5B22 /* SimpleButton.h */, A93CA2791AC2B8A800BD5B22 /* Supporting Files */, A93DE0DF1BE90C8200409A4B /* SimpleButtonStateChangeValue.swift */, ); path = SimpleButton; sourceTree = ""; }; A93CA2791AC2B8A800BD5B22 /* Supporting Files */ = { isa = PBXGroup; children = ( A93CA27A1AC2B8A800BD5B22 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ A93CA2741AC2B8A800BD5B22 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( A93CA27C1AC2B8A800BD5B22 /* SimpleButton.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 4D032ED51ADD858E00991630 /* SimpleButtonTests */ = { isa = PBXNativeTarget; buildConfigurationList = 4D032EDF1ADD858E00991630 /* Build configuration list for PBXNativeTarget "SimpleButtonTests" */; buildPhases = ( 4D032ED21ADD858E00991630 /* Sources */, 4D032ED31ADD858E00991630 /* Frameworks */, 4D032ED41ADD858E00991630 /* Resources */, ); buildRules = ( ); dependencies = ( 4D032EDE1ADD858E00991630 /* PBXTargetDependency */, ); name = SimpleButtonTests; productName = SimpleButtonTests; productReference = 4D032ED61ADD858E00991630 /* SimpleButtonTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; A93CA24C1AC2B89300BD5B22 /* Example */ = { isa = PBXNativeTarget; buildConfigurationList = A93CA26C1AC2B89300BD5B22 /* Build configuration list for PBXNativeTarget "Example" */; buildPhases = ( A93CA2491AC2B89300BD5B22 /* Sources */, A93CA24A1AC2B89300BD5B22 /* Frameworks */, A93CA24B1AC2B89300BD5B22 /* Resources */, A93CA2931AC2B8A900BD5B22 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( A93CA28D1AC2B8A900BD5B22 /* PBXTargetDependency */, ); name = Example; productName = Example; productReference = A93CA24D1AC2B89300BD5B22 /* Example.app */; productType = "com.apple.product-type.application"; }; A93CA2761AC2B8A800BD5B22 /* SimpleButton */ = { isa = PBXNativeTarget; buildConfigurationList = A93CA2901AC2B8A900BD5B22 /* Build configuration list for PBXNativeTarget "SimpleButton" */; buildPhases = ( A93CA2721AC2B8A800BD5B22 /* Sources */, A93CA2731AC2B8A800BD5B22 /* Frameworks */, A93CA2741AC2B8A800BD5B22 /* Headers */, A93CA2751AC2B8A800BD5B22 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = SimpleButton; productName = SimpleButton; productReference = A93CA2771AC2B8A800BD5B22 /* SimpleButton.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ A93CA2451AC2B89300BD5B22 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 1200; ORGANIZATIONNAME = "Andreas Tinoco Lobo"; TargetAttributes = { 4D032ED51ADD858E00991630 = { CreatedOnToolsVersion = 6.3; LastSwiftMigration = 0800; }; A93CA24C1AC2B89300BD5B22 = { CreatedOnToolsVersion = 6.3; DevelopmentTeam = M8F9QH57A6; LastSwiftMigration = 1100; }; A93CA2761AC2B8A800BD5B22 = { CreatedOnToolsVersion = 6.3; LastSwiftMigration = 1100; }; }; }; buildConfigurationList = A93CA2481AC2B89300BD5B22 /* Build configuration list for PBXProject "Example" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = A93CA2441AC2B89300BD5B22; productRefGroup = A93CA24E1AC2B89300BD5B22 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( A93CA24C1AC2B89300BD5B22 /* Example */, A93CA2761AC2B8A800BD5B22 /* SimpleButton */, 4D032ED51ADD858E00991630 /* SimpleButtonTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 4D032ED41ADD858E00991630 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; A93CA24B1AC2B89300BD5B22 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( A9C97EEE1AC45CCF005C14E0 /* Main.storyboard in Resources */, A93CA25D1AC2B89300BD5B22 /* LaunchScreen.xib in Resources */, A93CA25A1AC2B89300BD5B22 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; A93CA2751AC2B8A800BD5B22 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 4D032ED21ADD858E00991630 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 4D032EE31ADD85C600991630 /* SimpleButtonTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; A93CA2491AC2B89300BD5B22 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A93CA2531AC2B89300BD5B22 /* AppDelegate.swift in Sources */, A97727951C04B3E400FDC7B4 /* UIColorExtensions.swift in Sources */, A98449251BF4B991007E90C7 /* ViewController.swift in Sources */, BC95C8DB1D01790C00BC474C /* DesignableButton.swift in Sources */, A92045E61AD5803900401655 /* CustomButtons.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; A93CA2721AC2B8A800BD5B22 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A93CA2981AC2B91400BD5B22 /* SimpleButton.swift in Sources */, A93DE0E01BE90C8200409A4B /* SimpleButtonStateChangeValue.swift in Sources */, A93DE0DE1BE8E20F00409A4B /* SimpleButtonControlState.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 4D032EDE1ADD858E00991630 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = A93CA2761AC2B8A800BD5B22 /* SimpleButton */; targetProxy = 4D032EDD1ADD858E00991630 /* PBXContainerItemProxy */; }; A93CA28D1AC2B8A900BD5B22 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = A93CA2761AC2B8A800BD5B22 /* SimpleButton */; targetProxy = A93CA28C1AC2B8A900BD5B22 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ A93CA25B1AC2B89300BD5B22 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( A93CA25C1AC2B89300BD5B22 /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; A9C97EEC1AC45CCF005C14E0 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( A9C97EED1AC45CCF005C14E0 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 4D032EE01ADD858E00991630 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = SimpleButtonTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.aloco.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; }; name = Debug; }; 4D032EE11ADD858E00991630 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = SimpleButtonTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.aloco.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; }; name = Release; }; A93CA26A1AC2B89300BD5B22 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; A93CA26B1AC2B89300BD5B22 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; A93CA26D1AC2B89300BD5B22 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = M8F9QH57A6; INFOPLIST_FILE = Example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.aloco.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; }; name = Debug; }; A93CA26E1AC2B89300BD5B22 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = M8F9QH57A6; INFOPLIST_FILE = Example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.aloco.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; }; name = Release; }; A93CA2911AC2B8A900BD5B22 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = SimpleButton/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.aloco.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; A93CA2921AC2B8A900BD5B22 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SimpleButton/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.aloco.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 4D032EDF1ADD858E00991630 /* Build configuration list for PBXNativeTarget "SimpleButtonTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 4D032EE01ADD858E00991630 /* Debug */, 4D032EE11ADD858E00991630 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A93CA2481AC2B89300BD5B22 /* Build configuration list for PBXProject "Example" */ = { isa = XCConfigurationList; buildConfigurations = ( A93CA26A1AC2B89300BD5B22 /* Debug */, A93CA26B1AC2B89300BD5B22 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A93CA26C1AC2B89300BD5B22 /* Build configuration list for PBXNativeTarget "Example" */ = { isa = XCConfigurationList; buildConfigurations = ( A93CA26D1AC2B89300BD5B22 /* Debug */, A93CA26E1AC2B89300BD5B22 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A93CA2901AC2B8A900BD5B22 /* Build configuration list for PBXNativeTarget "SimpleButton" */ = { isa = XCConfigurationList; buildConfigurations = ( A93CA2911AC2B8A900BD5B22 /* Debug */, A93CA2921AC2B8A900BD5B22 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = A93CA2451AC2B89300BD5B22 /* Project object */; } ================================================ FILE: Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: Example.xcodeproj/xcshareddata/xcschemes/SimpleButton.xcscheme ================================================ ================================================ FILE: Example.xcodeproj/xcshareddata/xcschemes/SimpleButtonTests.xcscheme ================================================ ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Andreas Tinoco Lobo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Package.swift ================================================ // swift-tools-version:5.0 import PackageDescription let package = Package( name: "SimpleButton", platforms: [ .iOS(.v11) ], products: [ .library(name: "SimpleButton", targets: ["SimpleButton"]) ], dependencies: [ ], targets: [ .target(name: "SimpleButton", dependencies: [], path: "SimpleButton/") ], swiftLanguageVersions: [.v5] ) ================================================ FILE: README.md ================================================ # SimpleButton ![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat) [![Build Status](https://travis-ci.org/aloco/SimpleButton.svg?branch=swift-3.0)](https://travis-ci.org/aloco/SimpleButton) ![Swift 5](https://img.shields.io/badge/Swift-5-orange.svg) UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! [Full API docs](http://aloco.github.io/SimpleButton/swift_output) ![Sample](https://raw.githubusercontent.com/aloco/SimpleButton/master/Resources/example.gif) ## Usage Just create your own `SimpleButton` subclass and configure your button attributes by overriding `configureButtonStyles`. ```swift class PrimaryButton: SimpleButton { override func configureButtonStyles() { super.configureButtonStyles() setBorderWidth(4.0, for: .normal) setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal) setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted) setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal) setScale(0.98, for: .highlighted) setTitleColor(UIColor.whiteColor(), for: .normal) } } ``` For usage in Interfacebuilder, just use your `SimpleButton` subclass as custom class for any `UIButton` element. All defined styles gets applied automatically. You can also configure your button without a subclass directly inline. ```swift let awesomeButton = SimpleButton(type: .custom) awesomeButton.setBorderWidth(2.0, for: .normal) awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted) view.addSubview(awesomeButton) ``` Note that you should use `UIButtonType.custom` to avoid undesired effects. Please checkout the example project for a detailed usage demo. #### @IBDesignable Have a look on [DesignableButton](Example/DesignableButton.swift) subclass within the Example Project for `@IBDesignable` usage. ### Animation Each state change of `SimpleButton` animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the `animated` and `animationDuration` parameters. ``` setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2) setBorderWidth(8.0, for: .highlighted, animated: false) ``` This means, every state change to `.normal` animates the `borderWidth` to `4.0`. Every state change to `.highlighted` changes instantly the `borderWidth` to `8.0` without animation. ### Loading state `SimpleButton` has a custom `loading` state. You can toggle this state by setting `simpleButton.isLoading`. The button shows an `UIActivityIndicator` instead of the title when adding the `loading` state. ``` simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading) simpleButton.isLoading = true ``` If you don´t like the default loading indicator, you can set your own `UIView` by doing ``` simpleButton.loadingView = CustomAwesomeLoadingView() ``` Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs. ## Configurable attributes Take a look at the ```Setter for state attributes``` section of the [API Docs](http://aloco.github.io/SimpleButton/swift_output/Classes/SimpleButton.html#/Setter%20for%20state%20attributes) ## Installation Note that SimpleButton is written in `swift 5` and may not be compatible with previous versions of swift. #### Swift Package Manager (Recommended) Add the following dependency to your `Package.swift` file: ``` .package(url: "https://github.com/allaboutapps/SimpleButton.git", from: "5.0.0") ``` #### Carthage Add the following line to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). ``` github "allaboutapps/SimpleButton" ~> 5.0 ``` Then run `carthage update`. #### Manually Just drag and drop the `SimpleButton.swift` file into your project. ## Contributing * Create something awesome, make the code better, add some functionality, whatever (this is the hardest part). * [Fork it](http://help.github.com/forking/) * Create new branch to make your changes * Commit all your changes to your branch * Submit a [pull request](http://help.github.com/pull-requests/) ================================================ FILE: SimpleButton/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 4.0 CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: SimpleButton/SimpleButton.h ================================================ // // SimpleButton.h // SimpleButton // // Created by Andreas Tinoco Lobo on 25.03.15. // Copyright (c) 2015 Andreas Tinoco Lobo. All rights reserved. // #import //! Project version number for SimpleButton. FOUNDATION_EXPORT double SimpleButtonVersionNumber; //! Project version string for SimpleButton. FOUNDATION_EXPORT const unsigned char SimpleButtonVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import ================================================ FILE: SimpleButton/SimpleButton.swift ================================================ // // SimpleButton.swift // Example // // Created by Andreas Tinoco Lobo on 25.03.15. // Copyright (c) 2015 Andreas Tinoco Lobo. All rights reserved. // import UIKit open class SimpleButton: UIButton { typealias ControlState = UInt /// Loading view. UIActivityIndicatorView as default open var loadingView: UIView? /// Default duration of animated state change. open var defaultAnimationDuration: TimeInterval = 0.1 /// Represents current button state. open override var state: UIControl.State { // injects custom button state if necessary if isLoading { var options = SimpleButtonControlState.loading options.insert(super.state) return options } return super.state } /// used to lock any animated state transition for initial setup private var lockAnimatedUpdate: Bool = true /// used to determine the `from` value of any animation private var sourceLayer: CALayer { return (layer.presentation() ?? layer) } // MARK: State values with initial values private lazy var backgroundColors: [ControlState: SimpleButtonStateChangeValue] = { if let color = self.backgroundColor?.cgColor { return [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: color, animated: true, animationDuration: self.defaultAnimationDuration)] } return [:] }() private lazy var borderColors: [ControlState: SimpleButtonStateChangeValue] = { if let color = self.layer.borderColor { return [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: color, animated: true, animationDuration: self.defaultAnimationDuration)] } return [:] }() private lazy var buttonScales: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: 1.0, animated: true, animationDuration: self.defaultAnimationDuration)] }() private lazy var borderWidths: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: self.layer.borderWidth, animated: true, animationDuration: self.defaultAnimationDuration)] }() private lazy var cornerRadii: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: self.layer.cornerRadius, animated: true, animationDuration: self.defaultAnimationDuration)] }() private lazy var shadowColors: [ControlState: SimpleButtonStateChangeValue] = { if let color = self.layer.shadowColor { return [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: color, animated: true, animationDuration: self.defaultAnimationDuration)] } return [:] }() private lazy var shadowOpacities: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: self.layer.shadowOpacity, animated: true, animationDuration: self.defaultAnimationDuration)] }() private lazy var shadowOffsets: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: self.layer.shadowOffset, animated: true, animationDuration: self.defaultAnimationDuration)] }() private lazy var shadowRadii: [ControlState: SimpleButtonStateChangeValue] = { [UIControl.State.normal.rawValue: SimpleButtonStateChangeValue(value: self.layer.shadowRadius, animated: true, animationDuration: self.defaultAnimationDuration)] }() // MARK: Overrides open override var isEnabled: Bool { didSet { // manually enables / disables user interaction to restore correct state if loading or enabled state are switched separate or together if !isEnabled { self.isUserInteractionEnabled = false } else if !state.contains(SimpleButtonControlState.loading), isEnabled { self.isUserInteractionEnabled = true } update() } } open override var isHighlighted: Bool { didSet { update() } } open override var isSelected: Bool { didSet { update() } } // MARK: Custom states /// A Boolean value that determines the SimpleButton´s loading state. /// Specify `true` to switch to the loading state. /// If set to `true`, SimpleButton shows `loadingView` and hides the default `titleLabel` and `imageView` open var isLoading: Bool = false { didSet { DispatchQueue.main.async { if self.isLoading { if self.loadingView == nil { self.setDefaultLoadingView() } self.isUserInteractionEnabled = false self.showLoadingView(animaded: true) } else { if !self.state.contains(.disabled) { self.isUserInteractionEnabled = true } self.hideLoadingView(animaded: true) } self.update() } } } // MARK: Initializer public required override init(frame: CGRect) { super.init(frame: frame) setup() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } open override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() setup() } open override func awakeFromNib() { super.awakeFromNib() setup() } private func setup() { lockAnimatedUpdate = true configureButtonStyles() update() lockAnimatedUpdate = false } // MARK: Configuration /** To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true)) */ open func configureButtonStyles() {} // MARK: Setter for state attributes /** Sets the scale for a specific `UIControlState` - parameter scale: scale of button - parameter state: determines at which state that scale applies - parameter animated: determines if that change in scale should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { buttonScales[state.rawValue] = SimpleButtonStateChangeValue(value: scale, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateScale() } /** Sets the background color for a specific `UIControlState` - parameter color: background color of button - parameter state: determines at which state that background color applies - parameter animated: determines if that change in background color should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { backgroundColors[state.rawValue] = SimpleButtonStateChangeValue(value: color.cgColor, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateBackgroundColor() } /** Sets the border width for a specific `UIControlState` - parameter width: border width of button - parameter state: determines at which state that border width applies - parameter animated: determines if that change in border width should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { borderWidths[state.rawValue] = SimpleButtonStateChangeValue(value: width, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateBorderWidth() } /** Sets the border color for a specific `UIControlState` - parameter color: border color of button - parameter state: determines at which state that border color applies - parameter animated: determines if that change in border color should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { borderColors[state.rawValue] = SimpleButtonStateChangeValue(value: color.cgColor, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateBorderColor() } /** Sets the corner radius for a specific `UIControlState` - parameter radius: corner radius of button - parameter state: determines at which state that corner radius applies - parameter animated: determines if that change in radius of the corners should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { cornerRadii[state.rawValue] = SimpleButtonStateChangeValue(value: radius, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateCornerRadius() } /** Sets the shadow color for a specific `UIControlState` - parameter color: shadow color of button - parameter state: determines at which state that shadow color applies - parameter animated: determines if that change in shadow color should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { shadowColors[state.rawValue] = SimpleButtonStateChangeValue(value: color.cgColor, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateShadowColor() } /** Sets the shadow opacity for a specific `UIControlState` - parameter opacity: shadow opacity of button - parameter state: determines at which state that shadow opacity applies - parameter animated: determines if that change in shadow opacity should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { shadowOpacities[state.rawValue] = SimpleButtonStateChangeValue(value: opacity, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateShadowOpacity() } /** Sets the shadow radius for a specific `UIControlState` - parameter radius: shadow radius of button - parameter state: determines at which state that shadow radius applies - parameter animated: determines if that change in shadow radius should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { shadowRadii[state.rawValue] = SimpleButtonStateChangeValue(value: radius, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateShadowRadius() } /** Sets the shadow offset for a specific `UIControlState` - parameter offset: shadow offset of button - parameter state: determines at which state that shadow offset applies - parameter animated: determines if that change in shadow offset should animate. Default is `true` - parameter animationDuration: set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from `defaultAnimationDuration` */ open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil) { shadowOffsets[state.rawValue] = SimpleButtonStateChangeValue(value: offset, animated: animated, animationDuration: animationDuration ?? defaultAnimationDuration) updateShadowOffset() } /** Sets the spacing between `titleLabel` and `imageView` - parameter spacing: spacing between `titleLabel` and `imageView` */ open func setTitleImageSpacing(_ spacing: CGFloat) { imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: spacing / 2) titleEdgeInsets = UIEdgeInsets(top: 0, left: spacing / 2, bottom: 0, right: 0) } // MARK: Attribute update helper /** Updates all attributes if necessary. Each update function determines by itself if an update of any attribute is necessary. It also determines if that update should animate. - parameter lockAnimatedUpdate: set this to true to update without animation, even it´s defined in `SimpleButtonStateChange`. Used to set initial button attributes */ private func update() { updateBackgroundColor() updateBorderColor() updateBorderWidth() updateCornerRadius() updateScale() updateShadowColor() updateShadowOffset() updateShadowOpacity() updateShadowRadius() } private func updateCornerRadius() { if let stateChange = cornerRadii[state.rawValue] ?? cornerRadii[UIControl.State.normal.rawValue], stateChange.value != layer.cornerRadius { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.cornerRadius as AnyObject?, to: stateChange.value as AnyObject, forKey: "cornerRadius", duration: stateChange.animationDuration) } layer.cornerRadius = stateChange.value } } private func updateScale() { if let stateChange = buttonScales[state.rawValue] ?? buttonScales[UIControl.State.normal.rawValue], transform.a != stateChange.value, transform.b != stateChange.value { let animations = { self.transform = CGAffineTransform(scaleX: stateChange.value, y: stateChange.value) } stateChange.animated && !lockAnimatedUpdate ? UIView.animate(withDuration: stateChange.animationDuration, animations: animations) : animations() } } private func updateBackgroundColor() { if let stateChange = backgroundColors[state.rawValue] ?? backgroundColors[UIControl.State.normal.rawValue], layer.backgroundColor == nil || UIColor(cgColor: layer.backgroundColor!) != UIColor(cgColor: stateChange.value) { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.backgroundColor, to: stateChange.value, forKey: "backgroundColor", duration: stateChange.animationDuration) } layer.backgroundColor = stateChange.value } } private func updateBorderColor() { if let stateChange = borderColors[state.rawValue] ?? borderColors[UIControl.State.normal.rawValue], layer.borderColor == nil || UIColor(cgColor: layer.borderColor!) != UIColor(cgColor: stateChange.value) { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.borderColor, to: stateChange.value, forKey: "borderColor", duration: stateChange.animationDuration) } layer.borderColor = stateChange.value } } private func updateBorderWidth() { if let stateChange = borderWidths[state.rawValue] ?? borderWidths[UIControl.State.normal.rawValue], stateChange.value != layer.borderWidth { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.borderWidth as AnyObject?, to: stateChange.value as AnyObject, forKey: "borderWidth", duration: stateChange.animationDuration) } layer.borderWidth = stateChange.value } } private func updateShadowOffset() { if let stateChange = shadowOffsets[state.rawValue] ?? shadowOffsets[UIControl.State.normal.rawValue], stateChange.value != layer.shadowOffset { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: NSValue(cgSize: sourceLayer.shadowOffset), to: NSValue(cgSize: stateChange.value), forKey: "shadowOffset", duration: stateChange.animationDuration) } layer.shadowOffset = stateChange.value } } private func updateShadowColor() { if let stateChange = shadowColors[state.rawValue] ?? shadowColors[UIControl.State.normal.rawValue], layer.shadowColor == nil || UIColor(cgColor: layer.shadowColor!) != UIColor(cgColor: stateChange.value) { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.shadowColor, to: stateChange.value, forKey: "shadowColor", duration: stateChange.animationDuration) } layer.shadowColor = stateChange.value } } private func updateShadowRadius() { if let stateChange = shadowRadii[state.rawValue] ?? shadowRadii[UIControl.State.normal.rawValue], stateChange.value != layer.shadowRadius { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.shadowRadius as AnyObject?, to: stateChange.value as AnyObject, forKey: "shadowRadius", duration: stateChange.animationDuration) } layer.shadowRadius = stateChange.value } } private func updateShadowOpacity() { if let stateChange = shadowOpacities[state.rawValue] ?? shadowOpacities[UIControl.State.normal.rawValue], stateChange.value != layer.shadowOpacity { if stateChange.animated, !lockAnimatedUpdate { animate(layer: layer, from: sourceLayer.shadowOpacity as AnyObject?, to: stateChange.value as AnyObject, forKey: "shadowOpacity", duration: stateChange.animationDuration) } layer.shadowOpacity = stateChange.value } } // MARK: Animation helper private func animate(layer: CALayer, from: AnyObject?, to: AnyObject, forKey key: String, duration: TimeInterval) { let animation = CABasicAnimation() animation.fromValue = from animation.toValue = to animation.duration = duration layer.add(animation, forKey: key) } // MARK: Layout open override func layoutSubviews() { super.layoutSubviews() loadingView?.center = CGPoint(x: bounds.size.width / 2, y: bounds.size.height / 2) } // MARK: - LoadingView private func setDefaultLoadingView() { let activityIndicator = UIActivityIndicatorView(style: .white) activityIndicator.startAnimating() activityIndicator.hidesWhenStopped = false activityIndicator.alpha = 0 loadingView = activityIndicator } private func addLoadingViewAsSubView() { guard let loadingView = loadingView else { return } loadingView.translatesAutoresizingMaskIntoConstraints = false addSubview(loadingView) NSLayoutConstraint.activate([ trailingAnchor.constraint(equalTo: loadingView.trailingAnchor, constant: contentEdgeInsets.right), loadingView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: contentEdgeInsets.left), loadingView.topAnchor.constraint(equalTo: topAnchor, constant: contentEdgeInsets.top), bottomAnchor.constraint(equalTo: loadingView.bottomAnchor, constant: contentEdgeInsets.bottom) ]) layoutIfNeeded() } private func removeLoadingViewAsSubView() { loadingView?.removeFromSuperview() layoutIfNeeded() } private func showLoadingView(animaded: Bool) { let animation = { [weak self] in self?.loadingView?.alpha = 1 self?.titleLabel?.layer.opacity = 0 self?.imageView?.alpha = 0 } if loadingView?.superview == nil { addLoadingViewAsSubView() loadingView?.alpha = 0 } if animaded { loadingView?.alpha = 0 UIView.animate(withDuration: defaultAnimationDuration, animations: animation) } else { animation() } } private func hideLoadingView(animaded: Bool) { let animation = { [weak self] in self?.loadingView?.alpha = 0 self?.titleLabel?.layer.opacity = 2 self?.imageView?.alpha = 1 } let completion: (Bool) -> Void = { [weak self] _ in self?.removeLoadingViewAsSubView() } if animaded { UIView.animate(withDuration: defaultAnimationDuration, animations: animation, completion: completion) } else { animation() completion(true) } } } ================================================ FILE: SimpleButton/SimpleButtonControlState.swift ================================================ // // SimpleButtonControlState.swift // Example // // Created by Andreas Tinoco Lobo on 03/11/15. // Copyright © 2015 Andreas Tinoco Lobo. All rights reserved. // import UIKit /** * Custom SimpleButton control state */ public struct SimpleButtonControlState { /// Indicates loading state of SimpleButton public static let loading: UIControl.State = UIControl.State(rawValue: 1 << 16) } ================================================ FILE: SimpleButton/SimpleButtonStateChangeValue.swift ================================================ // // SimpleButtonStateChangeValue.swift // Example // // Created by Andreas Tinoco Lobo on 03/11/15. // Copyright © 2015 Andreas Tinoco Lobo. All rights reserved. // import Foundation /** * defines whether state transition to a given value should animate and at which speed */ struct SimpleButtonStateChangeValue { let value: T let animated: Bool let animationDuration: TimeInterval } ================================================ FILE: SimpleButton.podspec ================================================ Pod::Spec.new do |s| s.name = "SimpleButton" s.version = "4.0.1" s.summary = "Simple UIButton subclass with additional state change animations (e.g. backgroundColor)" s.description = "Simple UIButton subclass with animated, state-aware attributes. Easy to subclass and configure!" s.homepage = "https://github.com/aloco/SimpleButton" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Andreas Tinoco Lobo" => "andreas@tinoco-lobo.at" } s.platform = :ios s.ios.deployment_target = "8.1" s.source = { :git => "https://github.com/aloco/SimpleButton.git", :tag => s.version } s.requires_arc = true s.source_files = "SimpleButton/*.swift" s.swift_version = "4.0" end ================================================ FILE: SimpleButtonTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: SimpleButtonTests/SimpleButtonTests.swift ================================================ // // SimpleButtonTests.swift // SimpleButtonTests // // Created by Alexander Schuch on 14/04/15. // Copyright (c) 2015 Andreas Tinoco Lobo. All rights reserved. // import UIKit import XCTest import SimpleButton class SimpleButtonTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } // MARK: BackgroundColor func testSetBackgroundColor() { // This is an example of a functional test case. let button = SimpleButton(type: .custom) button.setBackgroundColor(UIColor.red) XCTAssertEqual(button.backgroundColor, UIColor.red, "backgroundColor doesn't match") } func testSetBackgroundColorStateChange() { let button = SimpleButton(type: .custom) button.setBackgroundColor(UIColor.green, for: .normal, animated: true) button.isEnabled = true XCTAssertEqual(button.backgroundColor, UIColor.green, "enabled backgroundColor doesn't match set color") button.setBackgroundColor(UIColor.red, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(button.backgroundColor, UIColor.red, "disabled backgroundColor doesn't match set color") } // MARK: BorderColor func testBorderColor() { let button = SimpleButton(type: .custom) button.setBorderColor(UIColor.red) XCTAssertEqual(UIColor(cgColor: button.layer.borderColor!), UIColor.red, "borderColor doesn't match") } func testBorderColorWithStateChange() { let button = SimpleButton(type: .custom) button.setBorderColor(UIColor.green, for: .normal, animated: true) button.isEnabled = true XCTAssertEqual(UIColor(cgColor: button.layer.borderColor!), UIColor.green, "enabled borderColor doesn't match") button.setBorderColor(UIColor.red, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(UIColor(cgColor: button.layer.borderColor!), UIColor.red, "disabled borderColor doesn't match") } // MARK: BorderWidth func testBorderWidthWithStateChange() { let button = SimpleButton(type: .custom) button.setBorderWidth(1.0) button.setBorderWidth(0.5, for: .highlighted, animated: true) let unhighlightedWidth = button.layer.borderWidth; button.isHighlighted = true let highlightedWidth = button.layer.borderWidth; XCTAssertEqual(unhighlightedWidth, 1.0, "unhighlightedWidth doesn't macth expected width of 1.0") XCTAssertEqual(highlightedWidth, 0.5, "highlightedWidth doesn't macth expected width of 0.5") } // MARK: CornerRadius func testSetCornerRadius() { let button = SimpleButton(type: .custom) button.setCornerRadius(2.0) XCTAssertEqual(button.layer.cornerRadius, 2.0, "corderRadius doesn't match") } func testSetCornerRadiusWithStateChange() { let button = SimpleButton(type: .custom) button.setCornerRadius(4.0, for: .normal, animated: true) button.isEnabled = true XCTAssertEqual(button.layer.cornerRadius, 4.0, "enabled corderRadius doesn't match") button.setCornerRadius(2.0, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(button.layer.cornerRadius, 2.0, "corderRadius doesn't match") } // MARK: Scale func testSetScale() { let button = SimpleButton(type: .custom) let originalScale = button.frame.height button.setScale(0.5) let halfSizeScale = button.frame.height XCTAssertEqual(originalScale * 0.5, halfSizeScale, "halfSizeScale scale doesn't match originalScale * 0.5") } func testScaleWithStateChange() { let button = SimpleButton(type: .custom) button.setScale(0.5, for: .selected, animated: true) let unselectedSize = button.frame.height button.isSelected = true let selectedSize = button.frame.height XCTAssertEqual(unselectedSize * 0.5, selectedSize, "selected scale doesn't match unselected scale * 0.5") } // MARK: ShadowColor func testSetShadowColor() { let button = SimpleButton(type: .custom) button.setShadowColor(UIColor.red, for: .normal, animated: true) XCTAssertEqual(UIColor(cgColor: button.layer.shadowColor ?? UIColor.blue.cgColor), UIColor.red, "shadowColor doesn't match") } func testSetShadowColorStateChange() { let button = SimpleButton(type: .custom) button.setShadowColor(UIColor.green, for: .normal, animated: true) button.isEnabled = true XCTAssertEqual(UIColor(cgColor: button.layer.shadowColor ?? UIColor.blue.cgColor), UIColor.green, "enabled backgroundColor doesn't match set color") button.setShadowColor(UIColor.red, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(UIColor(cgColor: button.layer.shadowColor ?? UIColor.blue.cgColor), UIColor.red, "disabled backgroundColor doesn't match set color") } // MARK: ShadowOffset func testSetShadowOffset() { let button = SimpleButton(type: .custom) let offset = CGSize(width: 10, height: 10) button.setShadowOffset(offset, for: .normal, animated: true) XCTAssertEqual(offset, button.layer.shadowOffset, "shadowOffset doesn't match") } func testSetShadowOffsetStateChange() { let button = SimpleButton(type: .custom) let offset = CGSize(width: 10, height: 10) button.setShadowOffset(offset, for: .normal, animated: true) XCTAssertEqual(offset, button.layer.shadowOffset, "shadowOffset doesn't match") let newOffset = CGSize(width: 2, height: 3) button.setShadowOffset(newOffset, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(newOffset, button.layer.shadowOffset, "disabled shadowOffset doesn't match") } // MARK: ShadowRadius func testSetShadowRadius() { let button = SimpleButton(type: .custom) let offset = CGSize(width: 10, height: 10) button.setShadowOffset(offset, for: .normal, animated: true) XCTAssertEqual(offset, button.layer.shadowOffset, "shadowOffset doesn't match") } func testSetShadowRadiusStateChange() { let button = SimpleButton(type: .custom) button.setShadowRadius(10, for: .normal, animated: true) XCTAssertEqual(10, button.layer.shadowRadius, "shadowRadius doesn't match") button.setShadowRadius(2, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(2, button.layer.shadowRadius, "disabled shadowRadius doesn't match") } // MARK: ShadowOpacity func testSetShadowOpacity() { let button = SimpleButton(type: .custom) let offset = CGSize(width: 10, height: 10) button.setShadowOffset(offset, for: .normal, animated: true) XCTAssertEqual(offset, button.layer.shadowOffset, "shadowOffset doesn't match") } func testSetShadowOpacityStateChange() { let button = SimpleButton(type: .custom) button.setShadowOpacity(1, for: .normal, animated: true) XCTAssertEqual(1, button.layer.shadowOpacity, "shadowOpacity doesn't match") button.setShadowOpacity(0.5, for: .disabled, animated: true) button.isEnabled = false XCTAssertEqual(0.5, button.layer.shadowOpacity, "disabled shadowOpacity doesn't match") } // MARK: EdgeCases func testChangeStateBackgroundColorWithoutStateChange() { let button = SimpleButton(type: .custom) button.setBackgroundColor(UIColor.green, for: .normal, animated: true) XCTAssertEqual(button.backgroundColor, UIColor.green, "backgorundColor doesn't match") button.setBackgroundColor(UIColor.red, for: .normal, animated: true) XCTAssertEqual(button.backgroundColor, UIColor.red, "backgorundColor doesn't match") } // MARK: StateChange tests func testStateChange() { let button = SimpleButton(type: .custom) XCTAssertEqual(button.state, UIControlState.normal, "state should be set to Normal") button.isHighlighted = true XCTAssertEqual(button.state, UIControlState.highlighted, "state should be set to Highlighted") button.isEnabled = false print(button.state) XCTAssert(button.state.contains(.highlighted), "state should contain highlighted") button.isLoading = true print(button.state) XCTAssert(button.state.contains(SimpleButtonControlState.loading), "state should contain Loading") } // MARK: Check correct enable / disable of userInteractionEnabled func testUserInteractionEnabled() { let button = SimpleButton(type: .custom) button.isEnabled = false XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isEnabled = true XCTAssert(button.isUserInteractionEnabled == true, "userInteractionEnabled should be set to true") button.isLoading = true XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isLoading = false XCTAssert(button.isUserInteractionEnabled == true, "userInteractionEnabled should be set to true") button.isLoading = true button.isEnabled = true XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isEnabled = false button.isLoading = false XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isLoading = false button.isEnabled = true XCTAssert(button.isUserInteractionEnabled == true, "userInteractionEnabled should be set to true") button.isLoading = true button.isEnabled = false XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isLoading = true button.isEnabled = false button.isLoading = false XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isLoading = false button.isEnabled = true button.isLoading = true XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") button.isEnabled = false button.isLoading = false button.isEnabled = true XCTAssert(button.isUserInteractionEnabled == true, "userInteractionEnabled should be set to true") button.isEnabled = true button.isLoading = true button.isEnabled = false XCTAssert(button.isUserInteractionEnabled == false, "userInteractionEnabled should be set to false") } } ================================================ FILE: docs/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton Docs (65% documented)

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • Loading view. UIActivityIndicatorView as default

    Declaration

    Swift

    open var loadingView: UIView?
  • Default duration of animated state change.

    Declaration

    Swift

    open var defaultAnimationDuration: TimeInterval
  • Represents current button state.

    Declaration

    Swift

    open override var state: UIControl.State { get }
  • Undocumented

    Declaration

    Swift

    override open var isEnabled: Bool { get set }
  • Undocumented

    Declaration

    Swift

    override open var isHighlighted: Bool { get set }
  • Undocumented

    Declaration

    Swift

    override open var isSelected: Bool { get set }
  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • Undocumented

    Declaration

    Swift

    required override public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    required public init?(coder aDecoder: NSCoder)
  • Undocumented

    Declaration

    Swift

    open override func prepareForInterfaceBuilder()
  • Undocumented

    Declaration

    Swift

    open override func awakeFromNib()
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

  • Undocumented

    Declaration

    Swift

    override open func layoutSubviews()
================================================ FILE: docs/Classes.html ================================================ Classes Reference

SimpleButton Docs (65% documented)

================================================ FILE: docs/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButton Docs (65% documented)

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/Structs.html ================================================ Structures Reference

SimpleButton Docs (65% documented)

================================================ FILE: docs/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Info.plist ================================================ CFBundleIdentifier com.jazzy.simplebutton CFBundleName SimpleButton DocSetPlatformFamily simplebutton isDashDocset dashIndexFilePath index.html isJavaScriptEnabled DashDocSetFamily dashtoc ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton Docs (65% documented)

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • Loading view. UIActivityIndicatorView as default

    Declaration

    Swift

    open var loadingView: UIView?
  • Default duration of animated state change.

    Declaration

    Swift

    open var defaultAnimationDuration: TimeInterval
  • Represents current button state.

    Declaration

    Swift

    open override var state: UIControl.State { get }
  • Undocumented

    Declaration

    Swift

    override open var isEnabled: Bool { get set }
  • Undocumented

    Declaration

    Swift

    override open var isHighlighted: Bool { get set }
  • Undocumented

    Declaration

    Swift

    override open var isSelected: Bool { get set }
  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • Undocumented

    Declaration

    Swift

    required override public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    required public init?(coder aDecoder: NSCoder)
  • Undocumented

    Declaration

    Swift

    open override func prepareForInterfaceBuilder()
  • Undocumented

    Declaration

    Swift

    open override func awakeFromNib()
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

  • Undocumented

    Declaration

    Swift

    override open func layoutSubviews()
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes.html ================================================ Classes Reference

SimpleButton Docs (65% documented)

================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButton Docs (65% documented)

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs.html ================================================ Structures Reference

SimpleButton Docs (65% documented)

================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/index.html ================================================ SimpleButton Reference

SimpleButton Docs (65% documented)

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/Classes.html ================================================ Classes Reference
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/Structs.html ================================================ Structures Reference
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Info.plist ================================================ CFBundleIdentifier com.jazzy.simplebutton CFBundleName SimpleButton DocSetPlatformFamily simplebutton isDashDocset dashIndexFilePath index.html isJavaScriptEnabled DashDocSetFamily dashtoc ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes.html ================================================ Classes Reference
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs.html ================================================ Structures Reference
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/index.html ================================================ SimpleButton Reference

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/docsets/SimpleButton.xml ================================================ 4.0https://github.com/aloco/SimpleButton/tree/swift-4.0/api/docsets/SimpleButton.tgz ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/index.html ================================================ SimpleButton Reference

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/docsets/SimpleButton.docset/Contents/Resources/Documents/swift_output/undocumented.json ================================================ { "warnings": [ { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 12, "symbol": "SimpleButton", "symbol_kind": "source.lang.swift.decl.class", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 90, "symbol": "SimpleButton.isEnabled", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 103, "symbol": "SimpleButton.isHighlighted", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 109, "symbol": "SimpleButton.isSelected", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 150, "symbol": "SimpleButton.init(frame:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 155, "symbol": "SimpleButton.init(coder:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 160, "symbol": "SimpleButton.prepareForInterfaceBuilder()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 165, "symbol": "SimpleButton.awakeFromNib()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 426, "symbol": "SimpleButton.layoutSubviews()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" } ], "source_directory": "/Users/andreastinocolobo/Applications/iOS/SimpleButton" } ================================================ FILE: docs/index.html ================================================ SimpleButton Reference

SimpleButton Docs (65% documented)

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/swift_output/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

================================================ FILE: docs/swift_output/Classes.html ================================================ Classes Reference
================================================ FILE: docs/swift_output/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/swift_output/Structs.html ================================================ Structures Reference
================================================ FILE: docs/swift_output/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/swift_output/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Info.plist ================================================ CFBundleIdentifier com.jazzy.simplebutton CFBundleName SimpleButton DocSetPlatformFamily simplebutton isDashDocset dashIndexFilePath index.html isJavaScriptEnabled DashDocSetFamily dashtoc ================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes/SimpleButton.html ================================================ SimpleButton Class Reference

SimpleButton

open class SimpleButton : UIButton

Undocumented

  • A Boolean value that determines the SimpleButton´s loading state. Specify true to switch to the loading state. If set to true, SimpleButton shows loadingView and hides the default titleLabel and imageView

    Declaration

    Swift

    open var isLoading: Bool { get set }
  • To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

    Declaration

    Swift

    open func configureButtonStyles()
  • Sets the scale for a specific UIControlState

    Declaration

    Swift

    open func setScale(_ scale: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    scale

    scale of button

    state

    determines at which state that scale applies

    animated

    determines if that change in scale should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the background color for a specific UIControlState

    Declaration

    Swift

    open func setBackgroundColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    background color of button

    state

    determines at which state that background color applies

    animated

    determines if that change in background color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border width for a specific UIControlState

    Declaration

    Swift

    open func setBorderWidth(_ width: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    width

    border width of button

    state

    determines at which state that border width applies

    animated

    determines if that change in border width should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the border color for a specific UIControlState

    Declaration

    Swift

    open func setBorderColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    border color of button

    state

    determines at which state that border color applies

    animated

    determines if that change in border color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the corner radius for a specific UIControlState

    Declaration

    Swift

    open func setCornerRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    corner radius of button

    state

    determines at which state that corner radius applies

    animated

    determines if that change in radius of the corners should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow color for a specific UIControlState

    Declaration

    Swift

    open func setShadowColor(_ color: UIColor, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    color

    shadow color of button

    state

    determines at which state that shadow color applies

    animated

    determines if that change in shadow color should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow opacity for a specific UIControlState

    Declaration

    Swift

    open func setShadowOpacity(_ opacity: Float, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    opacity

    shadow opacity of button

    state

    determines at which state that shadow opacity applies

    animated

    determines if that change in shadow opacity should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow radius for a specific UIControlState

    Declaration

    Swift

    open func setShadowRadius(_ radius: CGFloat, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    radius

    shadow radius of button

    state

    determines at which state that shadow radius applies

    animated

    determines if that change in shadow radius should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the shadow offset for a specific UIControlState

    Declaration

    Swift

    open func setShadowOffset(_ offset: CGSize, for state: UIControl.State = .normal, animated: Bool = true, animationDuration: TimeInterval? = nil)

    Parameters

    offset

    shadow offset of button

    state

    determines at which state that shadow offset applies

    animated

    determines if that change in shadow offset should animate. Default is true

    animationDuration

    set this value if you need a specific animation duration for this specific state change. If this is nil, the animation duration is taken from defaultAnimationDuration

  • Sets the spacing between titleLabel and imageView

    Declaration

    Swift

    open func setTitleImageSpacing(_ spacing: CGFloat)

    Parameters

    spacing

    spacing between titleLabel and imageView

================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Classes.html ================================================ Classes Reference
================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs/SimpleButtonControlState.html ================================================ SimpleButtonControlState Structure Reference

SimpleButtonControlState

public struct SimpleButtonControlState

Custom SimpleButton control state

  • Indicates loading state of SimpleButton

    Declaration

    Swift

    public static let loading: UIControl.State
================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/Structs.html ================================================ Structures Reference
================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/css/highlight.css ================================================ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight { /* Comment */ /* Error */ /* Keyword */ /* Operator */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Deleted.Specific */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Inserted.Specific */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/css/jazzy.css ================================================ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { background: transparent; border: 0; margin: 0; outline: 0; padding: 0; vertical-align: baseline; } body { background-color: #f2f2f2; font-family: Helvetica, freesans, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: subpixel-antialiased; word-wrap: break-word; } h1, h2, h3 { margin-top: 0.8em; margin-bottom: 0.3em; font-weight: 100; color: black; } h1 { font-size: 2.5em; } h2 { font-size: 2em; border-bottom: 1px solid #e2e2e2; } h4 { font-size: 13px; line-height: 1.5; margin-top: 21px; } h5 { font-size: 1.1em; } h6 { font-size: 1.1em; color: #777; } .section-name { color: gray; display: block; font-family: Helvetica; font-size: 22px; font-weight: 100; margin-bottom: 15px; } pre, code { font: 0.95em Menlo, monospace; color: #777; word-wrap: normal; } p code, li code { background-color: #eee; padding: 2px 4px; border-radius: 4px; } a { color: #0088cc; text-decoration: none; } ul { padding-left: 15px; } li { line-height: 1.8em; } img { max-width: 100%; } blockquote { margin-left: 0; padding: 0 10px; border-left: 4px solid #ccc; } .content-wrapper { margin: 0 auto; width: 980px; } header { font-size: 0.85em; line-height: 26px; background-color: #414141; position: fixed; width: 100%; z-index: 1; } header img { padding-right: 6px; vertical-align: -4px; height: 16px; } header a { color: #fff; } header p { float: left; color: #999; } header .header-right { float: right; margin-left: 16px; } #breadcrumbs { background-color: #f2f2f2; height: 27px; padding-top: 17px; position: fixed; width: 100%; z-index: 1; margin-top: 26px; } #breadcrumbs #carat { height: 10px; margin: 0 5px; } .sidebar { background-color: #f9f9f9; border: 1px solid #e2e2e2; overflow-y: auto; overflow-x: hidden; position: fixed; top: 70px; bottom: 0; width: 230px; word-wrap: normal; } .nav-groups { list-style-type: none; background: #fff; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #e2e2e2; font-size: 1.1em; font-weight: 100; padding: 15px 0 15px 20px; } .nav-group-name > a { color: #333; } .nav-group-tasks { margin-top: 5px; } .nav-group-task { font-size: 0.9em; list-style-type: none; white-space: nowrap; } .nav-group-task a { color: #888; } .main-content { background-color: #fff; border: 1px solid #e2e2e2; margin-left: 246px; position: absolute; overflow: hidden; padding-bottom: 60px; top: 70px; width: 734px; } .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { margin-bottom: 1em; } .main-content p { line-height: 1.8em; } .main-content section .section:first-child { margin-top: 0; padding-top: 0; } .main-content section .task-group-section .task-group:first-of-type { padding-top: 10px; } .main-content section .task-group-section .task-group:first-of-type .section-name { padding-top: 15px; } .main-content section .heading:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .section { padding: 0 25px; } .highlight { background-color: #eee; padding: 10px 12px; border: 1px solid #e2e2e2; border-radius: 4px; overflow-x: auto; } .declaration .highlight { overflow-x: initial; padding: 0 40px 40px 0; margin-bottom: -25px; background-color: transparent; border: none; } .section-name { margin: 0; margin-left: 18px; } .task-group-section { padding-left: 6px; border-top: 1px solid #e2e2e2; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; padding-top: 70px; margin: -70px 0 0; } .item code { background-color: transparent; padding: 0; } .item .token { padding-left: 3px; margin-left: 15px; font-size: 11.9px; } .item .declaration-note { font-size: .85em; color: gray; font-style: italic; } .pointer-container { border-bottom: 1px solid #e2e2e2; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { background: #f9f9f9; border-left: 1px solid #e2e2e2; border-top: 1px solid #e2e2e2; height: 12px; left: 21px; top: -7px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); position: absolute; width: 12px; } .height-container { display: none; left: -25px; padding: 0 25px; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #f9f9f9; border-bottom: 1px solid #e2e2e2; left: -25px; position: relative; width: 100%; padding-top: 10px; padding-bottom: 5px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4b8afb; } .aside-warning { border-left: 5px solid #ff6666; } .aside-warning .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #e2e2e2; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } #footer { position: absolute; bottom: 10px; margin-left: 25px; } #footer p { margin: 0; color: #aaa; font-size: 0.8em; } html.dash header, html.dash #breadcrumbs, html.dash .sidebar { display: none; } html.dash .main-content { width: 980px; margin-left: 0; border: none; width: 100%; top: 0; padding-bottom: 0; } html.dash .height-container { display: block; } html.dash .item .token { margin-left: 0; } html.dash .content-wrapper { width: auto; } html.dash #footer { position: static; } ================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/index.html ================================================ SimpleButton Reference

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/swift_output/docsets/SimpleButton.docset/Contents/Resources/Documents/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/swift_output/docsets/SimpleButton.xml ================================================ 4.0https://github.com/aloco/SimpleButton/tree/swift-4.0/api/docsets/SimpleButton.tgz ================================================ FILE: docs/swift_output/index.html ================================================ SimpleButton Reference

SimpleButton

Carthage compatible Build Status Swift 4

UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs

Sample

Usage

Just create your own SimpleButton subclass and configure your button attributes by overriding configureButtonStyles.

class PrimaryButton: SimpleButton {
    override func configureButtonStyles() {
        super.configureButtonStyles()
        setBorderWidth(4.0, for: .normal)
        setBackgroundColor(UIColor(red: 52/255, green: 73/255, blue: 94/255, alpha: 1.0), for: .normal)
        setBackgroundColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .highlighted)
        setBorderColor(UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0), for: .normal)
        setScale(0.98, for: .highlighted)
        setTitleColor(UIColor.whiteColor(), for: .normal)
    }
}

For usage in Interfacebuilder, just use your SimpleButton subclass as custom class for any UIButton element. All defined styles gets applied automatically.

You can also configure your button without a subclass directly inline.

let awesomeButton = SimpleButton(type: .custom)
awesomeButton.setBorderWidth(2.0, for: .normal)
awesomeButton.setBorderColor(UIColor.redColor(), for: .highlighted)
view.addSubview(awesomeButton)

Note that you should use UIButtonType.custom to avoid undesired effects.

Please checkout the example project for a detailed usage demo.

@IBDesignable

Have a look on DesignableButton subclass within the Example Project for @IBDesignable usage.

Animation

Each state change of SimpleButton animates by default. Sometimes you need to define which state transition should animate and which should happen immediately. Therefore you can control that behaviour with the animated and animationDuration parameters.

setBorderWidth(4.0, for: .normal, animated: true, animationDuration: 0.2)
setBorderWidth(8.0, for: .highlighted, animated: false)

This means, every state change to .normal animates the borderWidth to 4.0. Every state change to .highlighted changes instantly the borderWidth to 8.0 without animation.

Loading state

SimpleButton has a custom loading state. You can toggle this state by setting simpleButton.isLoading. The button shows an UIActivityIndicator instead of the title when adding the loading state.

simpleButton.setCornerRadius(20, for: SimpleButtonControlState.loading)
simpleButton.isLoading = true

If you don´t like the default loading indicator, you can set your own UIView by doing

simpleButton.loadingView = CustomAwesomeLoadingView()

Please note, when using a custom loading view don´t forget to handle the position and initial add to subview by yourself to fit your needs.

Configurable attributes

Take a look at the Setter for state attributes section of the API Docs

Installation

Note that SimpleButton is written in swift 4 and may not be compatible with previous versions of swift.

Carthage

Add the following line to your Cartfile.

github "aloco/SimpleButton" ~> 4.0

Then run carthage update.

Manually

Just drag and drop the SimpleButton.swift file into your project.

Contributing

  • Create something awesome, make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create new branch to make your changes
  • Commit all your changes to your branch
  • Submit a pull request
================================================ FILE: docs/swift_output/js/jazzy.js ================================================ window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } // On doc load, toggle the URL hash discussion if present $(document).ready(function() { if (!window.jazzy.docset) { var linkToHash = $('a[href="' + window.location.hash +'"]'); linkToHash.trigger("click"); } }); // On token click, toggle its discussion and animate token.marginLeft $(".token").click(function(event) { if (window.jazzy.docset) { return; } var link = $(this); var animationDuration = 300; var tokenOffset = "15px"; var original = link.css('marginLeft') == tokenOffset; link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); $content = link.parent().parent().next(); $content.slideToggle(animationDuration); // Keeps the document from jumping to the hash. var href = $(this).attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Dumb down quotes within code blocks that delimit strings instead of quotations // https://github.com/realm/jazzy/issues/714 $("code q").replaceWith(function () { return ["\"", $(this).contents(), "\""]; }); ================================================ FILE: docs/swift_output/search.json ================================================ {"Structs/SimpleButtonControlState.html#/s:12SimpleButton0aB12ControlStateV7loadingSo09UIControlD0VvpZ":{"name":"loading","abstract":"

Indicates loading state of SimpleButton

","parent_name":"SimpleButtonControlState"},"Structs/SimpleButtonControlState.html":{"name":"SimpleButtonControlState","abstract":"

Custom SimpleButton control state

"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC11loadingViewSo6UIViewCSgvp":{"name":"loadingView","abstract":"

Loading view. UIActivityIndicatorView as default

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC24defaultAnimationDurationSdvp":{"name":"defaultAnimationDuration","abstract":"

Default duration of animated state change.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)state":{"name":"state","abstract":"

Represents current button state.

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)enabled":{"name":"isEnabled","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)highlighted":{"name":"isHighlighted","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(py)selected":{"name":"isSelected","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC9isLoadingSbvp":{"name":"isLoading","abstract":"

A Boolean value that determines the SimpleButton´s loading state.","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithFrame:":{"name":"init(frame:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)initWithCoder:":{"name":"init(coder:)","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)prepareForInterfaceBuilder":{"name":"prepareForInterfaceBuilder()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)awakeFromNib":{"name":"awakeFromNib()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC09configureB6StylesyyF":{"name":"configureButtonStyles()","abstract":"

To define various styles for specific button states, override this function and set attributes for specific states (e.g. setBackgroundColor(UIColor.blueColor(), for: .Highlighted, animated: true))

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC8setScale_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setScale(_:for:animated:animationDuration:)","abstract":"

Sets the scale for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC18setBackgroundColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBackgroundColor(_:for:animated:animationDuration:)","abstract":"

Sets the background color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderWidth_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setBorderWidth(_:for:animated:animationDuration:)","abstract":"

Sets the border width for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setBorderColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setBorderColor(_:for:animated:animationDuration:)","abstract":"

Sets the border color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setCornerRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setCornerRadius(_:for:animated:animationDuration:)","abstract":"

Sets the corner radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC14setShadowColor_3for8animated17animationDurationySo7UIColorC_So14UIControlStateVSbSdSgtF":{"name":"setShadowColor(_:for:animated:animationDuration:)","abstract":"

Sets the shadow color for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC16setShadowOpacity_3for8animated17animationDurationySf_So14UIControlStateVSbSdSgtF":{"name":"setShadowOpacity(_:for:animated:animationDuration:)","abstract":"

Sets the shadow opacity for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowRadius_3for8animated17animationDurationy12CoreGraphics7CGFloatV_So14UIControlStateVSbSdSgtF":{"name":"setShadowRadius(_:for:animated:animationDuration:)","abstract":"

Sets the shadow radius for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC15setShadowOffset_3for8animated17animationDurationySo6CGSizeV_So14UIControlStateVSbSdSgtF":{"name":"setShadowOffset(_:for:animated:animationDuration:)","abstract":"

Sets the shadow offset for a specific UIControlState

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/s:12SimpleButtonAAC20setTitleImageSpacingyy12CoreGraphics7CGFloatVF":{"name":"setTitleImageSpacing(_:)","abstract":"

Sets the spacing between titleLabel and imageView

","parent_name":"SimpleButton"},"Classes/SimpleButton.html#/c:@M@SimpleButton@objc(cs)SimpleButton(im)layoutSubviews":{"name":"layoutSubviews()","abstract":"

Undocumented

","parent_name":"SimpleButton"},"Classes/SimpleButton.html":{"name":"SimpleButton","abstract":"

Undocumented

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"}} ================================================ FILE: docs/swift_output/undocumented.json ================================================ { "warnings": [ { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 12, "symbol": "SimpleButton", "symbol_kind": "source.lang.swift.decl.class", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 90, "symbol": "SimpleButton.isEnabled", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 103, "symbol": "SimpleButton.isHighlighted", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 109, "symbol": "SimpleButton.isSelected", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 150, "symbol": "SimpleButton.init(frame:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 155, "symbol": "SimpleButton.init(coder:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 160, "symbol": "SimpleButton.prepareForInterfaceBuilder()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 165, "symbol": "SimpleButton.awakeFromNib()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 426, "symbol": "SimpleButton.layoutSubviews()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" } ], "source_directory": "/Users/andreastinocolobo/Applications/iOS/SimpleButton" } ================================================ FILE: docs/undocumented.json ================================================ { "warnings": [ { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 12, "symbol": "SimpleButton", "symbol_kind": "source.lang.swift.decl.class", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 90, "symbol": "SimpleButton.isEnabled", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 103, "symbol": "SimpleButton.isHighlighted", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 109, "symbol": "SimpleButton.isSelected", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 150, "symbol": "SimpleButton.init(frame:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 155, "symbol": "SimpleButton.init(coder:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 160, "symbol": "SimpleButton.prepareForInterfaceBuilder()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 165, "symbol": "SimpleButton.awakeFromNib()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/andreastinocolobo/Applications/iOS/SimpleButton/SimpleButton/SimpleButton.swift", "line": 426, "symbol": "SimpleButton.layoutSubviews()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" } ], "source_directory": "/Users/andreastinocolobo/Applications/iOS/SimpleButton" }