├── .gitignore ├── .travis.yml ├── DTLoadingButton.gif ├── DTLoadingButton.podspec ├── Example ├── DTLoadingButton.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── DTLoadingButton-Example.xcscheme ├── DTLoadingButton.xcworkspace │ └── contents.xcworkspacedata ├── DTLoadingButton │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift ├── Podfile ├── Podfile.lock └── Tests │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── Pod ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ └── DTLoadingButton.swift ├── README.md ├── Screen.Shot.2016-03-02.at.12.02.44.png └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | language: objective-c 6 | # cache: cocoapods 7 | # podfile: Example/Podfile 8 | # before_install: 9 | # - gem install cocoapods # Since Travis is not always on latest version 10 | # - pod install --project-directory=Example 11 | script: 12 | - set -o pipefail && xcodebuild test -workspace Example/DTLoadingButton.xcworkspace -scheme DTLoadingButton-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty 13 | - pod lib lint 14 | -------------------------------------------------------------------------------- /DTLoadingButton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trongcuong1710/DTLoadingButton/9112239cbde4e649d88d5043f6de6a27f7b661fb/DTLoadingButton.gif -------------------------------------------------------------------------------- /DTLoadingButton.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint DTLoadingButton.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "DTLoadingButton" 11 | s.version = "0.1.1" 12 | s.summary = "Custom button to show activity indicator to represent loading state." 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | #s.description = "some description" 20 | 21 | s.homepage = "https://github.com/trongcuong1710/DTLoadingButton" 22 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 23 | s.license = 'MIT' 24 | s.author = { "Cuong Doan" => "trongcuong1710@gmail.com" } 25 | s.source = { :git => "https://github.com/trongcuong1710/DTLoadingButton.git", :tag => s.version.to_s } 26 | # s.social_media_url = 'https://twitter.com/' 27 | 28 | s.platform = :ios, '8.0' 29 | s.requires_arc = true 30 | 31 | s.source_files = 'Pod/Classes/**/*' 32 | s.resource_bundles = { 33 | 'DTLoadingButton' => ['Pod/Assets/*.png'] 34 | } 35 | 36 | # s.public_header_files = 'Pod/Classes/**/*.h' 37 | # s.frameworks = 'UIKit', 'MapKit' 38 | s.dependency 'SWActivityIndicatorView' 39 | end 40 | -------------------------------------------------------------------------------- /Example/DTLoadingButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 11 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 12 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 13 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 14 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 15 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 16 | B070BC50481224EC9345FA04 /* Pods_DTLoadingButton_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE81EB9D1718A937AAD8A38D /* Pods_DTLoadingButton_Example.framework */; }; 17 | CBB545350CDB3B5B1CB545D5 /* Pods_DTLoadingButton_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65B3B1A2455F2973A25FB753 /* Pods_DTLoadingButton_Tests.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 26 | remoteInfo = DTLoadingButton; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 27C0D0E4B420FE98B57E0F8D /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 32 | 4C0CB57865127931ED9F260A /* Pods-DTLoadingButton_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DTLoadingButton_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-DTLoadingButton_Example/Pods-DTLoadingButton_Example.release.xcconfig"; sourceTree = ""; }; 33 | 607FACD01AFB9204008FA782 /* DTLoadingButton_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DTLoadingButton_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 37 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 40 | 607FACE51AFB9204008FA782 /* DTLoadingButton_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DTLoadingButton_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 43 | 65B3B1A2455F2973A25FB753 /* Pods_DTLoadingButton_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DTLoadingButton_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 7A13421F40B31577886753F8 /* Pods-DTLoadingButton_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DTLoadingButton_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DTLoadingButton_Tests/Pods-DTLoadingButton_Tests.release.xcconfig"; sourceTree = ""; }; 45 | 9EC4C67F6DD42AFE1054E068 /* Pods-DTLoadingButton_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DTLoadingButton_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DTLoadingButton_Tests/Pods-DTLoadingButton_Tests.debug.xcconfig"; sourceTree = ""; }; 46 | BB90EAD251A5A04D9FABF9F3 /* Pods-DTLoadingButton_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DTLoadingButton_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DTLoadingButton_Example/Pods-DTLoadingButton_Example.debug.xcconfig"; sourceTree = ""; }; 47 | BE81EB9D1718A937AAD8A38D /* Pods_DTLoadingButton_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DTLoadingButton_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | D28A882DDBBDF1A4AD54404E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 49 | F8F9EBE7ED5E3C2620A3BF35 /* DTLoadingButton.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = DTLoadingButton.podspec; path = ../DTLoadingButton.podspec; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | B070BC50481224EC9345FA04 /* Pods_DTLoadingButton_Example.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | CBB545350CDB3B5B1CB545D5 /* Pods_DTLoadingButton_Tests.framework in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | 3819BD229DDF1F09723E0D0A /* Frameworks */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | BE81EB9D1718A937AAD8A38D /* Pods_DTLoadingButton_Example.framework */, 76 | 65B3B1A2455F2973A25FB753 /* Pods_DTLoadingButton_Tests.framework */, 77 | ); 78 | name = Frameworks; 79 | sourceTree = ""; 80 | }; 81 | 607FACC71AFB9204008FA782 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 85 | 607FACD21AFB9204008FA782 /* Example for DTLoadingButton */, 86 | 607FACE81AFB9204008FA782 /* Tests */, 87 | 607FACD11AFB9204008FA782 /* Products */, 88 | 60D942FE2689FB5DDE6D5293 /* Pods */, 89 | 3819BD229DDF1F09723E0D0A /* Frameworks */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 607FACD11AFB9204008FA782 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 607FACD01AFB9204008FA782 /* DTLoadingButton_Example.app */, 97 | 607FACE51AFB9204008FA782 /* DTLoadingButton_Tests.xctest */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 607FACD21AFB9204008FA782 /* Example for DTLoadingButton */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 106 | 607FACD71AFB9204008FA782 /* ViewController.swift */, 107 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 108 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 109 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 110 | 607FACD31AFB9204008FA782 /* Supporting Files */, 111 | ); 112 | name = "Example for DTLoadingButton"; 113 | path = DTLoadingButton; 114 | sourceTree = ""; 115 | }; 116 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 607FACD41AFB9204008FA782 /* Info.plist */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | 607FACE81AFB9204008FA782 /* Tests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 128 | 607FACE91AFB9204008FA782 /* Supporting Files */, 129 | ); 130 | path = Tests; 131 | sourceTree = ""; 132 | }; 133 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 607FACEA1AFB9204008FA782 /* Info.plist */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | F8F9EBE7ED5E3C2620A3BF35 /* DTLoadingButton.podspec */, 145 | 27C0D0E4B420FE98B57E0F8D /* README.md */, 146 | D28A882DDBBDF1A4AD54404E /* LICENSE */, 147 | ); 148 | name = "Podspec Metadata"; 149 | sourceTree = ""; 150 | }; 151 | 60D942FE2689FB5DDE6D5293 /* Pods */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | BB90EAD251A5A04D9FABF9F3 /* Pods-DTLoadingButton_Example.debug.xcconfig */, 155 | 4C0CB57865127931ED9F260A /* Pods-DTLoadingButton_Example.release.xcconfig */, 156 | 9EC4C67F6DD42AFE1054E068 /* Pods-DTLoadingButton_Tests.debug.xcconfig */, 157 | 7A13421F40B31577886753F8 /* Pods-DTLoadingButton_Tests.release.xcconfig */, 158 | ); 159 | name = Pods; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXGroup section */ 163 | 164 | /* Begin PBXNativeTarget section */ 165 | 607FACCF1AFB9204008FA782 /* DTLoadingButton_Example */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DTLoadingButton_Example" */; 168 | buildPhases = ( 169 | 8E21A53FE5002A86EADA5530 /* Check Pods Manifest.lock */, 170 | 607FACCC1AFB9204008FA782 /* Sources */, 171 | 607FACCD1AFB9204008FA782 /* Frameworks */, 172 | 607FACCE1AFB9204008FA782 /* Resources */, 173 | BBF251A6CC53AA531B7E25D6 /* Embed Pods Frameworks */, 174 | 318DCC3C1C1C4C83F7486532 /* Copy Pods Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | ); 180 | name = DTLoadingButton_Example; 181 | productName = DTLoadingButton; 182 | productReference = 607FACD01AFB9204008FA782 /* DTLoadingButton_Example.app */; 183 | productType = "com.apple.product-type.application"; 184 | }; 185 | 607FACE41AFB9204008FA782 /* DTLoadingButton_Tests */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DTLoadingButton_Tests" */; 188 | buildPhases = ( 189 | 819E7C759C947E69A5CD6563 /* Check Pods Manifest.lock */, 190 | 607FACE11AFB9204008FA782 /* Sources */, 191 | 607FACE21AFB9204008FA782 /* Frameworks */, 192 | 607FACE31AFB9204008FA782 /* Resources */, 193 | 7ED7AED58EC16C16B62DFE00 /* Embed Pods Frameworks */, 194 | 366C8E615A22107F21A328BF /* Copy Pods Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 200 | ); 201 | name = DTLoadingButton_Tests; 202 | productName = Tests; 203 | productReference = 607FACE51AFB9204008FA782 /* DTLoadingButton_Tests.xctest */; 204 | productType = "com.apple.product-type.bundle.unit-test"; 205 | }; 206 | /* End PBXNativeTarget section */ 207 | 208 | /* Begin PBXProject section */ 209 | 607FACC81AFB9204008FA782 /* Project object */ = { 210 | isa = PBXProject; 211 | attributes = { 212 | LastSwiftUpdateCheck = 0720; 213 | LastUpgradeCheck = 0720; 214 | ORGANIZATIONNAME = CocoaPods; 215 | TargetAttributes = { 216 | 607FACCF1AFB9204008FA782 = { 217 | CreatedOnToolsVersion = 6.3.1; 218 | }; 219 | 607FACE41AFB9204008FA782 = { 220 | CreatedOnToolsVersion = 6.3.1; 221 | TestTargetID = 607FACCF1AFB9204008FA782; 222 | }; 223 | }; 224 | }; 225 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DTLoadingButton" */; 226 | compatibilityVersion = "Xcode 3.2"; 227 | developmentRegion = English; 228 | hasScannedForEncodings = 0; 229 | knownRegions = ( 230 | en, 231 | Base, 232 | ); 233 | mainGroup = 607FACC71AFB9204008FA782; 234 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 235 | projectDirPath = ""; 236 | projectRoot = ""; 237 | targets = ( 238 | 607FACCF1AFB9204008FA782 /* DTLoadingButton_Example */, 239 | 607FACE41AFB9204008FA782 /* DTLoadingButton_Tests */, 240 | ); 241 | }; 242 | /* End PBXProject section */ 243 | 244 | /* Begin PBXResourcesBuildPhase section */ 245 | 607FACCE1AFB9204008FA782 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 250 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 251 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | 607FACE31AFB9204008FA782 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXShellScriptBuildPhase section */ 265 | 318DCC3C1C1C4C83F7486532 /* Copy Pods Resources */ = { 266 | isa = PBXShellScriptBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | inputPaths = ( 271 | ); 272 | name = "Copy Pods Resources"; 273 | outputPaths = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | shellPath = /bin/sh; 277 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DTLoadingButton_Example/Pods-DTLoadingButton_Example-resources.sh\"\n"; 278 | showEnvVarsInLog = 0; 279 | }; 280 | 366C8E615A22107F21A328BF /* Copy Pods Resources */ = { 281 | isa = PBXShellScriptBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | ); 285 | inputPaths = ( 286 | ); 287 | name = "Copy Pods Resources"; 288 | outputPaths = ( 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | shellPath = /bin/sh; 292 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DTLoadingButton_Tests/Pods-DTLoadingButton_Tests-resources.sh\"\n"; 293 | showEnvVarsInLog = 0; 294 | }; 295 | 7ED7AED58EC16C16B62DFE00 /* Embed Pods Frameworks */ = { 296 | isa = PBXShellScriptBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | ); 300 | inputPaths = ( 301 | ); 302 | name = "Embed Pods Frameworks"; 303 | outputPaths = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | shellPath = /bin/sh; 307 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DTLoadingButton_Tests/Pods-DTLoadingButton_Tests-frameworks.sh\"\n"; 308 | showEnvVarsInLog = 0; 309 | }; 310 | 819E7C759C947E69A5CD6563 /* Check Pods Manifest.lock */ = { 311 | isa = PBXShellScriptBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | ); 315 | inputPaths = ( 316 | ); 317 | name = "Check Pods Manifest.lock"; 318 | outputPaths = ( 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | shellPath = /bin/sh; 322 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 323 | showEnvVarsInLog = 0; 324 | }; 325 | 8E21A53FE5002A86EADA5530 /* Check Pods Manifest.lock */ = { 326 | isa = PBXShellScriptBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | ); 330 | inputPaths = ( 331 | ); 332 | name = "Check Pods Manifest.lock"; 333 | outputPaths = ( 334 | ); 335 | runOnlyForDeploymentPostprocessing = 0; 336 | shellPath = /bin/sh; 337 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 338 | showEnvVarsInLog = 0; 339 | }; 340 | BBF251A6CC53AA531B7E25D6 /* Embed Pods Frameworks */ = { 341 | isa = PBXShellScriptBuildPhase; 342 | buildActionMask = 2147483647; 343 | files = ( 344 | ); 345 | inputPaths = ( 346 | ); 347 | name = "Embed Pods Frameworks"; 348 | outputPaths = ( 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | shellPath = /bin/sh; 352 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DTLoadingButton_Example/Pods-DTLoadingButton_Example-frameworks.sh\"\n"; 353 | showEnvVarsInLog = 0; 354 | }; 355 | /* End PBXShellScriptBuildPhase section */ 356 | 357 | /* Begin PBXSourcesBuildPhase section */ 358 | 607FACCC1AFB9204008FA782 /* Sources */ = { 359 | isa = PBXSourcesBuildPhase; 360 | buildActionMask = 2147483647; 361 | files = ( 362 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 363 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 364 | ); 365 | runOnlyForDeploymentPostprocessing = 0; 366 | }; 367 | 607FACE11AFB9204008FA782 /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | /* End PBXSourcesBuildPhase section */ 376 | 377 | /* Begin PBXTargetDependency section */ 378 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 379 | isa = PBXTargetDependency; 380 | target = 607FACCF1AFB9204008FA782 /* DTLoadingButton_Example */; 381 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 382 | }; 383 | /* End PBXTargetDependency section */ 384 | 385 | /* Begin PBXVariantGroup section */ 386 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 387 | isa = PBXVariantGroup; 388 | children = ( 389 | 607FACDA1AFB9204008FA782 /* Base */, 390 | ); 391 | name = Main.storyboard; 392 | sourceTree = ""; 393 | }; 394 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 395 | isa = PBXVariantGroup; 396 | children = ( 397 | 607FACDF1AFB9204008FA782 /* Base */, 398 | ); 399 | name = LaunchScreen.xib; 400 | sourceTree = ""; 401 | }; 402 | /* End PBXVariantGroup section */ 403 | 404 | /* Begin XCBuildConfiguration section */ 405 | 607FACED1AFB9204008FA782 /* Debug */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 410 | CLANG_CXX_LIBRARY = "libc++"; 411 | CLANG_ENABLE_MODULES = YES; 412 | CLANG_ENABLE_OBJC_ARC = YES; 413 | CLANG_WARN_BOOL_CONVERSION = YES; 414 | CLANG_WARN_CONSTANT_CONVERSION = YES; 415 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 416 | CLANG_WARN_EMPTY_BODY = YES; 417 | CLANG_WARN_ENUM_CONVERSION = YES; 418 | CLANG_WARN_INT_CONVERSION = YES; 419 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 420 | CLANG_WARN_UNREACHABLE_CODE = YES; 421 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 422 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 423 | COPY_PHASE_STRIP = NO; 424 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 425 | ENABLE_STRICT_OBJC_MSGSEND = YES; 426 | ENABLE_TESTABILITY = YES; 427 | GCC_C_LANGUAGE_STANDARD = gnu99; 428 | GCC_DYNAMIC_NO_PIC = NO; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_OPTIMIZATION_LEVEL = 0; 431 | GCC_PREPROCESSOR_DEFINITIONS = ( 432 | "DEBUG=1", 433 | "$(inherited)", 434 | ); 435 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 436 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 437 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 438 | GCC_WARN_UNDECLARED_SELECTOR = YES; 439 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 440 | GCC_WARN_UNUSED_FUNCTION = YES; 441 | GCC_WARN_UNUSED_VARIABLE = YES; 442 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 443 | MTL_ENABLE_DEBUG_INFO = YES; 444 | ONLY_ACTIVE_ARCH = YES; 445 | SDKROOT = iphoneos; 446 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 447 | }; 448 | name = Debug; 449 | }; 450 | 607FACEE1AFB9204008FA782 /* Release */ = { 451 | isa = XCBuildConfiguration; 452 | buildSettings = { 453 | ALWAYS_SEARCH_USER_PATHS = NO; 454 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 455 | CLANG_CXX_LIBRARY = "libc++"; 456 | CLANG_ENABLE_MODULES = YES; 457 | CLANG_ENABLE_OBJC_ARC = YES; 458 | CLANG_WARN_BOOL_CONVERSION = YES; 459 | CLANG_WARN_CONSTANT_CONVERSION = YES; 460 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 461 | CLANG_WARN_EMPTY_BODY = YES; 462 | CLANG_WARN_ENUM_CONVERSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 465 | CLANG_WARN_UNREACHABLE_CODE = YES; 466 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 467 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 468 | COPY_PHASE_STRIP = NO; 469 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 470 | ENABLE_NS_ASSERTIONS = NO; 471 | ENABLE_STRICT_OBJC_MSGSEND = YES; 472 | GCC_C_LANGUAGE_STANDARD = gnu99; 473 | GCC_NO_COMMON_BLOCKS = YES; 474 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 475 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 476 | GCC_WARN_UNDECLARED_SELECTOR = YES; 477 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 478 | GCC_WARN_UNUSED_FUNCTION = YES; 479 | GCC_WARN_UNUSED_VARIABLE = YES; 480 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 481 | MTL_ENABLE_DEBUG_INFO = NO; 482 | SDKROOT = iphoneos; 483 | VALIDATE_PRODUCT = YES; 484 | }; 485 | name = Release; 486 | }; 487 | 607FACF01AFB9204008FA782 /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | baseConfigurationReference = BB90EAD251A5A04D9FABF9F3 /* Pods-DTLoadingButton_Example.debug.xcconfig */; 490 | buildSettings = { 491 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 492 | INFOPLIST_FILE = DTLoadingButton/Info.plist; 493 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 494 | MODULE_NAME = ExampleApp; 495 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | }; 498 | name = Debug; 499 | }; 500 | 607FACF11AFB9204008FA782 /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | baseConfigurationReference = 4C0CB57865127931ED9F260A /* Pods-DTLoadingButton_Example.release.xcconfig */; 503 | buildSettings = { 504 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 505 | INFOPLIST_FILE = DTLoadingButton/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 507 | MODULE_NAME = ExampleApp; 508 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | }; 511 | name = Release; 512 | }; 513 | 607FACF31AFB9204008FA782 /* Debug */ = { 514 | isa = XCBuildConfiguration; 515 | baseConfigurationReference = 9EC4C67F6DD42AFE1054E068 /* Pods-DTLoadingButton_Tests.debug.xcconfig */; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | FRAMEWORK_SEARCH_PATHS = ( 519 | "$(SDKROOT)/Developer/Library/Frameworks", 520 | "$(inherited)", 521 | ); 522 | GCC_PREPROCESSOR_DEFINITIONS = ( 523 | "DEBUG=1", 524 | "$(inherited)", 525 | ); 526 | INFOPLIST_FILE = Tests/Info.plist; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DTLoadingButton_Example.app/DTLoadingButton_Example"; 531 | }; 532 | name = Debug; 533 | }; 534 | 607FACF41AFB9204008FA782 /* Release */ = { 535 | isa = XCBuildConfiguration; 536 | baseConfigurationReference = 7A13421F40B31577886753F8 /* Pods-DTLoadingButton_Tests.release.xcconfig */; 537 | buildSettings = { 538 | BUNDLE_LOADER = "$(TEST_HOST)"; 539 | FRAMEWORK_SEARCH_PATHS = ( 540 | "$(SDKROOT)/Developer/Library/Frameworks", 541 | "$(inherited)", 542 | ); 543 | INFOPLIST_FILE = Tests/Info.plist; 544 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 545 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DTLoadingButton_Example.app/DTLoadingButton_Example"; 548 | }; 549 | name = Release; 550 | }; 551 | /* End XCBuildConfiguration section */ 552 | 553 | /* Begin XCConfigurationList section */ 554 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DTLoadingButton" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 607FACED1AFB9204008FA782 /* Debug */, 558 | 607FACEE1AFB9204008FA782 /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DTLoadingButton_Example" */ = { 564 | isa = XCConfigurationList; 565 | buildConfigurations = ( 566 | 607FACF01AFB9204008FA782 /* Debug */, 567 | 607FACF11AFB9204008FA782 /* Release */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DTLoadingButton_Tests" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 607FACF31AFB9204008FA782 /* Debug */, 576 | 607FACF41AFB9204008FA782 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | /* End XCConfigurationList section */ 582 | }; 583 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 584 | } 585 | -------------------------------------------------------------------------------- /Example/DTLoadingButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/DTLoadingButton.xcodeproj/xcshareddata/xcschemes/DTLoadingButton-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Example/DTLoadingButton.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DTLoadingButton 4 | // 5 | 6 | import UIKit 7 | 8 | @UIApplicationMain 9 | class AppDelegate: UIResponder, UIApplicationDelegate { 10 | var window: UIWindow? 11 | 12 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 13 | // Override point for customization after application launch. 14 | return true 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 31 | 42 | 53 | 64 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/DTLoadingButton/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DTLoadingButton 4 | // 5 | 6 | import UIKit 7 | import DTLoadingButton 8 | 9 | class ViewController: UIViewController { 10 | @IBOutlet private weak var button: DTLoadingButton! 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | // Do any additional setup after loading the view, typically from a nib. 15 | } 16 | 17 | @IBAction private func startButtonDidTouch(sender: UIButton) { 18 | self.button.startAnimating() 19 | } 20 | 21 | @IBAction private func stopButtonDidTouch(sender: UIButton) { 22 | self.button.stopAnimating() 23 | } 24 | 25 | @IBAction private func changeIndicatorColorToRed(sender: UIButton) { 26 | self.button.indicatorColor = UIColor.redColor() 27 | } 28 | 29 | @IBAction private func changeIndicatorColorToBlue(sender: UIButton) { 30 | self.button.indicatorColor = UIColor.blueColor() 31 | let button = DTLoadingButton(type: .Custom) 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | target 'DTLoadingButton_Example', :exclusive => true do 5 | pod 'DTLoadingButton', :path => '../' 6 | pod 'SWActivityIndicatorView' 7 | end 8 | 9 | target 'DTLoadingButton_Tests', :exclusive => true do 10 | pod 'DTLoadingButton', :path => '../' 11 | 12 | 13 | end 14 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DTLoadingButton (0.1.0): 3 | - SWActivityIndicatorView 4 | - SWActivityIndicatorView (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - DTLoadingButton (from `../`) 8 | - SWActivityIndicatorView 9 | 10 | EXTERNAL SOURCES: 11 | DTLoadingButton: 12 | :path: "../" 13 | 14 | SPEC CHECKSUMS: 15 | DTLoadingButton: 0a86b7ddd812e1e99a97a4bd48efa8a6175683c6 16 | SWActivityIndicatorView: 950f50c2e6fec7338d13c8b95c1a6c9fca4f516f 17 | 18 | COCOAPODS: 0.39.0 19 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import XCTest 3 | import DTLoadingButton 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | } 11 | 12 | override func tearDown() { 13 | // Put teardown code here. This method is called after the invocation of each test method in the class. 14 | super.tearDown() 15 | } 16 | 17 | func testExample() { 18 | // This is an example of a functional test case. 19 | XCTAssert(true, "Pass") 20 | } 21 | 22 | func testPerformanceExample() { 23 | // This is an example of a performance test case. 24 | self.measureBlock() { 25 | // Put the code you want to measure the time of here. 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Trong Cuong 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trongcuong1710/DTLoadingButton/9112239cbde4e649d88d5043f6de6a27f7b661fb/Pod/Assets/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trongcuong1710/DTLoadingButton/9112239cbde4e649d88d5043f6de6a27f7b661fb/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/DTLoadingButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DTLoadingButton.swift 3 | // Pods 4 | // 5 | 6 | import UIKit 7 | import SWActivityIndicatorView 8 | 9 | // 10 | // MARK: Initialize and default setup 11 | // 12 | @IBDesignable 13 | public class DTLoadingButton: UIButton { 14 | private var indicatorView: SWActivityIndicatorView = SWActivityIndicatorView(frame: CGRectZero) 15 | 16 | @IBInspectable public var disabledTextColor: UIColor! = UIColor.whiteColor() 17 | @IBInspectable public var enabledTextColor: UIColor! = UIColor.whiteColor() { 18 | didSet { 19 | self.setTitleColor(self.enabledTextColor, forState: .Normal) 20 | } 21 | } 22 | 23 | @IBInspectable public var disabledBackgroundColor: UIColor! = UIColor(red: 0, green: 131.0 / 255.0, blue: 191.0 / 255.0, alpha: 1.0) 24 | @IBInspectable public var enabledBackgroundColor: UIColor! = UIColor(red: 0, green: 152.0 / 255.0, blue: 215.0 / 255.0, alpha: 1.0) { 25 | didSet { 26 | self.backgroundColor = self.enabledBackgroundColor 27 | } 28 | } 29 | 30 | @IBInspectable public var indicatorViewLineWidth: CGFloat = 2.0 { 31 | didSet { 32 | self.indicatorView.lineWidth = self.indicatorViewLineWidth 33 | } 34 | } 35 | 36 | @IBInspectable public var indicatorColor: UIColor! = UIColor.lightGrayColor() { 37 | didSet { 38 | self.indicatorView.color = self.indicatorColor 39 | } 40 | } 41 | 42 | @IBInspectable public var normalText: String! = "" { 43 | didSet { 44 | self.setTitle(self.normalText, forState: .Normal) 45 | } 46 | } 47 | @IBInspectable public var loadingText: String! = "LOADING..." 48 | 49 | override init(frame: CGRect) { 50 | super.init(frame: frame) 51 | 52 | self.commonInit() 53 | } 54 | 55 | required public init?(coder aDecoder: NSCoder) { 56 | super.init(coder: aDecoder) 57 | 58 | self.commonInit() 59 | } 60 | 61 | private func commonInit() { 62 | self.initIndicatorView() 63 | self.initView() 64 | } 65 | 66 | private func initIndicatorView() { 67 | self.indicatorView.lineWidth = self.indicatorViewLineWidth 68 | self.indicatorView.color = self.indicatorColor 69 | self.indicatorView.backgroundColor = self.enabledBackgroundColor 70 | self.indicatorView.hidden = true 71 | } 72 | 73 | private func initView() { 74 | self.backgroundColor = self.enabledBackgroundColor 75 | self.setTitleColor(self.enabledTextColor, forState: .Normal) 76 | self.setTitle(self.normalText, forState: .Normal) 77 | } 78 | 79 | private func setupIndicatorView() { 80 | self.indicatorView.removeFromSuperview() 81 | self.indicatorView.frame = self.calculateIndicatorViewFrame() 82 | self.indicatorView.backgroundColor = self.disabledBackgroundColor 83 | 84 | self.addSubview(indicatorView) 85 | 86 | if !self.indicatorView.hidden { 87 | self.indicatorView.startAnimating() 88 | } 89 | } 90 | 91 | private func calculateIndicatorViewFrame() -> CGRect { 92 | let padding: CGFloat = 5 93 | var y = padding 94 | var height = self.frame.height - (padding * 2) 95 | var width = height 96 | var x = (self.frame.width / 2) - (width / 2) 97 | 98 | if let label = self.titleLabel { 99 | height = label.frame.height - 5 100 | width = height 101 | x = label.frame.origin.x - (width + padding) 102 | y = label.frame.origin.y + ((label.frame.height - height) / 2.0) 103 | return CGRectMake(x, y, width, height) 104 | } 105 | 106 | return CGRectMake(x, y, width, height) 107 | } 108 | 109 | private func startAnimatingIndicatorView() { 110 | self.indicatorView.hidden = false 111 | self.indicatorView.startAnimating() 112 | } 113 | 114 | private func stopAnimatingIndicatorView() { 115 | self.indicatorView.hidden = true 116 | self.indicatorView.stopAnimating() 117 | } 118 | 119 | override public func drawRect(rect: CGRect) { 120 | self.setupIndicatorView() 121 | 122 | super.drawRect(rect) 123 | } 124 | } 125 | 126 | // 127 | // MARK: Public methods and properties 128 | // 129 | extension DTLoadingButton { 130 | public func disable() { 131 | self.setTitle(self.loadingText, forState: .Normal) 132 | self.backgroundColor = self.disabledBackgroundColor 133 | self.setTitleColor(self.disabledTextColor, forState: .Normal) 134 | self.userInteractionEnabled = false 135 | } 136 | 137 | public func enable() { 138 | self.setTitle(self.normalText, forState: .Normal) 139 | self.backgroundColor = self.enabledBackgroundColor 140 | self.setTitleColor(self.enabledTextColor, forState: .Normal) 141 | self.userInteractionEnabled = true 142 | } 143 | 144 | public func startAnimating() { 145 | self.disable() 146 | self.startAnimatingIndicatorView() 147 | } 148 | 149 | public func stopAnimating() { 150 | self.enable() 151 | self.stopAnimatingIndicatorView() 152 | } 153 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DTLoadingButton 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/DTLoadingButton.svg?style=flat)](http://cocoapods.org/pods/DTLoadingButton) 4 | [![License](https://img.shields.io/cocoapods/l/DTLoadingButton.svg?style=flat)](http://cocoapods.org/pods/DTLoadingButton) 5 | [![Platform](https://img.shields.io/cocoapods/p/DTLoadingButton.svg?style=flat)](http://cocoapods.org/pods/DTLoadingButton) 6 | 7 | ![Demo gif](https://github.com/trongcuong1710/DTLoadingButton/blob/master/DTLoadingButton.gif) 8 | 9 | ## Summary 10 | 11 | This is a custom button to show loading state with an activity indicator sit next to title label. When on loading state (startAnimating), `userInteraction` will be disable. 12 | 13 | ## Usage 14 | 15 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 16 | 17 | ## Requirements 18 | 19 | iOS 8 or above 20 | 21 | ## Installation 22 | 23 | DTLoadingButton is available through [CocoaPods](http://cocoapods.org). To install 24 | it, simply add the following line to your Podfile: 25 | 26 | ```ruby 27 | pod "DTLoadingButton" 28 | ``` 29 | 30 | ## How to use 31 | 32 | Initialize via code 33 | 34 | ```swift 35 | let button = DTLoadingButton(type: .Custom) 36 | button.frame = CGRectMake(100, 100, 300, 40) 37 | 38 | self.addSubview(button) 39 | ``` 40 | 41 | Start animating 42 | 43 | ```swift 44 | button.startAnimating 45 | ``` 46 | 47 | Stop animating 48 | 49 | ```swift 50 | button.stopAnimating 51 | ``` 52 | 53 | You can also use this with Interface Builder by dragging an UIButton to your view controller. Set class to `DTLoadingButton`. 54 | 55 | ![Interface Builder](https://github.com/trongcuong1710/DTLoadingButton/blob/master/Screen.Shot.2016-03-02.at.12.02.44.png) 56 | 57 | *Note* You must set button type to `Custom` to avoid flickering when `start` and `stop` animating. 58 | 59 | ## Customization 60 | 61 | ```swift 62 | self.disabledTextColor = UIColor.whiteColor() 63 | self.enabledTextColor = UIColor.whiteColor() 64 | self.disabledBackgroundColor = UIColor(red: 0, green: 131.0 / 255.0, blue: 191.0 / 255.0, alpha: 1.0) 65 | self.enabledBackgroundColor = UIColor(red: 0, green: 152.0 / 255.0, blue: 215.0 / 255.0, alpha: 1.0) 66 | self.indicatorViewLineWidth = 2.0 67 | self.indicatorColor = UIColor.lightGrayColor() 68 | self.normalText = "" 69 | self.loadingText = "LOADING..." 70 | ``` 71 | 72 | ## License 73 | 74 | DTLoadingButton is available under the MIT license. See the LICENSE file for more info. 75 | -------------------------------------------------------------------------------- /Screen.Shot.2016-03-02.at.12.02.44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trongcuong1710/DTLoadingButton/9112239cbde4e649d88d5043f6de6a27f7b661fb/Screen.Shot.2016-03-02.at.12.02.44.png -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------