├── .gitignore ├── .swift-version ├── Image ├── limitButtonSelect.gif └── limitButtonSelect2.gif ├── License ├── LimitButtonSelect.podspec ├── LimitButtonSelect.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── jeasung.lee.xcuserdatad │ └── xcschemes │ ├── LimitButtonSelect.xcscheme │ └── xcschememanagement.plist ├── LimitButtonSelect ├── Info.plist ├── LimitButtonSelect.h └── LimitButtonSelect.swift ├── LimitSelectDemo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Button.swift ├── Info.plist └── ViewController.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | tignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 2 | 3 | ## Build generated 4 | build/ 5 | DerivedData/ 6 | 7 | ## Various settings 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata/ 17 | 18 | ## Other 19 | *.moved-aside 20 | *.xccheckout 21 | *.xcscmblueprint 22 | 23 | ## Obj-C/Swift specific 24 | *.hmap 25 | *.ipa 26 | *.dSYM.zip 27 | *.dSYM 28 | 29 | ## Playgrounds 30 | timeline.xctimeline 31 | playground.xcworkspace 32 | 33 | # Swift Package Manager 34 | # 35 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 36 | # Packages/ 37 | # Package.pins 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /Image/limitButtonSelect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeaSungLEE/LimitButtonSelect/5ee925d9dcf0168b68bb68b717815af52261dd54/Image/limitButtonSelect.gif -------------------------------------------------------------------------------- /Image/limitButtonSelect2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeaSungLEE/LimitButtonSelect/5ee925d9dcf0168b68bb68b717815af52261dd54/Image/limitButtonSelect2.gif -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 kaskay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LimitButtonSelect.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | 5 | s.name = "LimitButtonSelect" 6 | s.version = "0.0.2" 7 | s.summary = "A short description of LimitButtonSelect." 8 | 9 | 10 | s.description = <<-DESC 11 | Limited button Select, written in Swift 3. 12 | DESC 13 | s.homepage = "https://github.com/kaskay/LimitButtonSelect" 14 | 15 | 16 | 17 | s.license = { :type => "MIT", :file => "FILE_LICENSE" } 18 | 19 | 20 | s.author = { "jeasung.lee" => "wotjdzz1@naver.com" } 21 | 22 | s.platform = :ios, "9.0" 23 | 24 | s.source = { :git => "https://github.com/kaskay/LimitButtonSelect.git", :tag => "#{s.version}" } 25 | 26 | s.source_files = "LimitButtonSelect/**/*.swift" 27 | s.framework = "UIKit" 28 | 29 | s.requires_arc = true 30 | 31 | 32 | end 33 | -------------------------------------------------------------------------------- /LimitButtonSelect.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 391F20531F3ACAB10044EEC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391F20521F3ACAB10044EEC0 /* AppDelegate.swift */; }; 11 | 391F20551F3ACAB10044EEC0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391F20541F3ACAB10044EEC0 /* ViewController.swift */; }; 12 | 391F20581F3ACAB10044EEC0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 391F20561F3ACAB10044EEC0 /* Main.storyboard */; }; 13 | 391F205A1F3ACAB10044EEC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 391F20591F3ACAB10044EEC0 /* Assets.xcassets */; }; 14 | 391F205D1F3ACAB10044EEC0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 391F205B1F3ACAB10044EEC0 /* LaunchScreen.storyboard */; }; 15 | 391F20631F3ACB140044EEC0 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391F20621F3ACB140044EEC0 /* Button.swift */; }; 16 | 3952177C1F3AA61A00F8AF09 /* LimitButtonSelect.h in Headers */ = {isa = PBXBuildFile; fileRef = 3952177A1F3AA61A00F8AF09 /* LimitButtonSelect.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17 | 395217831F3AA62600F8AF09 /* LimitButtonSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395217821F3AA62600F8AF09 /* LimitButtonSelect.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 391F20501F3ACAB10044EEC0 /* LimitSelectDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LimitSelectDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 391F20521F3ACAB10044EEC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 391F20541F3ACAB10044EEC0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | 391F20571F3ACAB10044EEC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 391F20591F3ACAB10044EEC0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 391F205C1F3ACAB10044EEC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 391F205E1F3ACAB10044EEC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 391F20621F3ACB140044EEC0 /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; 29 | 395217771F3AA61A00F8AF09 /* LimitButtonSelect.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LimitButtonSelect.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 3952177A1F3AA61A00F8AF09 /* LimitButtonSelect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LimitButtonSelect.h; sourceTree = ""; }; 31 | 3952177B1F3AA61A00F8AF09 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 395217821F3AA62600F8AF09 /* LimitButtonSelect.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LimitButtonSelect.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 391F204D1F3ACAB10044EEC0 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | 395217731F3AA61A00F8AF09 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | 391F20511F3ACAB10044EEC0 /* LimitSelectDemo */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 391F20521F3ACAB10044EEC0 /* AppDelegate.swift */, 57 | 391F20541F3ACAB10044EEC0 /* ViewController.swift */, 58 | 391F20561F3ACAB10044EEC0 /* Main.storyboard */, 59 | 391F20591F3ACAB10044EEC0 /* Assets.xcassets */, 60 | 391F205B1F3ACAB10044EEC0 /* LaunchScreen.storyboard */, 61 | 391F205E1F3ACAB10044EEC0 /* Info.plist */, 62 | 391F20621F3ACB140044EEC0 /* Button.swift */, 63 | ); 64 | path = LimitSelectDemo; 65 | sourceTree = ""; 66 | }; 67 | 3952176D1F3AA61A00F8AF09 = { 68 | isa = PBXGroup; 69 | children = ( 70 | 395217791F3AA61A00F8AF09 /* LimitButtonSelect */, 71 | 391F20511F3ACAB10044EEC0 /* LimitSelectDemo */, 72 | 395217781F3AA61A00F8AF09 /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | 395217781F3AA61A00F8AF09 /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 395217771F3AA61A00F8AF09 /* LimitButtonSelect.framework */, 80 | 391F20501F3ACAB10044EEC0 /* LimitSelectDemo.app */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 395217791F3AA61A00F8AF09 /* LimitButtonSelect */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 3952177A1F3AA61A00F8AF09 /* LimitButtonSelect.h */, 89 | 3952177B1F3AA61A00F8AF09 /* Info.plist */, 90 | 395217821F3AA62600F8AF09 /* LimitButtonSelect.swift */, 91 | ); 92 | path = LimitButtonSelect; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXHeadersBuildPhase section */ 98 | 395217741F3AA61A00F8AF09 /* Headers */ = { 99 | isa = PBXHeadersBuildPhase; 100 | buildActionMask = 2147483647; 101 | files = ( 102 | 3952177C1F3AA61A00F8AF09 /* LimitButtonSelect.h in Headers */, 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | /* End PBXHeadersBuildPhase section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 391F204F1F3ACAB10044EEC0 /* LimitSelectDemo */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 391F205F1F3ACAB10044EEC0 /* Build configuration list for PBXNativeTarget "LimitSelectDemo" */; 112 | buildPhases = ( 113 | 391F204C1F3ACAB10044EEC0 /* Sources */, 114 | 391F204D1F3ACAB10044EEC0 /* Frameworks */, 115 | 391F204E1F3ACAB10044EEC0 /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = LimitSelectDemo; 122 | productName = LimitSelectDemo; 123 | productReference = 391F20501F3ACAB10044EEC0 /* LimitSelectDemo.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | 395217761F3AA61A00F8AF09 /* LimitButtonSelect */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = 3952177F1F3AA61A00F8AF09 /* Build configuration list for PBXNativeTarget "LimitButtonSelect" */; 129 | buildPhases = ( 130 | 395217721F3AA61A00F8AF09 /* Sources */, 131 | 395217731F3AA61A00F8AF09 /* Frameworks */, 132 | 395217741F3AA61A00F8AF09 /* Headers */, 133 | 395217751F3AA61A00F8AF09 /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = LimitButtonSelect; 140 | productName = LimitButtonSelect; 141 | productReference = 395217771F3AA61A00F8AF09 /* LimitButtonSelect.framework */; 142 | productType = "com.apple.product-type.framework"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 3952176E1F3AA61A00F8AF09 /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastSwiftUpdateCheck = 0830; 151 | LastUpgradeCheck = 0830; 152 | ORGANIZATIONNAME = jeasung.lee; 153 | TargetAttributes = { 154 | 391F204F1F3ACAB10044EEC0 = { 155 | CreatedOnToolsVersion = 8.3.3; 156 | ProvisioningStyle = Automatic; 157 | }; 158 | 395217761F3AA61A00F8AF09 = { 159 | CreatedOnToolsVersion = 8.3.3; 160 | LastSwiftMigration = 0830; 161 | ProvisioningStyle = Automatic; 162 | }; 163 | }; 164 | }; 165 | buildConfigurationList = 395217711F3AA61A00F8AF09 /* Build configuration list for PBXProject "LimitButtonSelect" */; 166 | compatibilityVersion = "Xcode 3.2"; 167 | developmentRegion = English; 168 | hasScannedForEncodings = 0; 169 | knownRegions = ( 170 | en, 171 | Base, 172 | ); 173 | mainGroup = 3952176D1F3AA61A00F8AF09; 174 | productRefGroup = 395217781F3AA61A00F8AF09 /* Products */; 175 | projectDirPath = ""; 176 | projectRoot = ""; 177 | targets = ( 178 | 395217761F3AA61A00F8AF09 /* LimitButtonSelect */, 179 | 391F204F1F3ACAB10044EEC0 /* LimitSelectDemo */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 391F204E1F3ACAB10044EEC0 /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 391F205D1F3ACAB10044EEC0 /* LaunchScreen.storyboard in Resources */, 190 | 391F205A1F3ACAB10044EEC0 /* Assets.xcassets in Resources */, 191 | 391F20581F3ACAB10044EEC0 /* Main.storyboard in Resources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | 395217751F3AA61A00F8AF09 /* Resources */ = { 196 | isa = PBXResourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXResourcesBuildPhase section */ 203 | 204 | /* Begin PBXSourcesBuildPhase section */ 205 | 391F204C1F3ACAB10044EEC0 /* Sources */ = { 206 | isa = PBXSourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 391F20551F3ACAB10044EEC0 /* ViewController.swift in Sources */, 210 | 391F20631F3ACB140044EEC0 /* Button.swift in Sources */, 211 | 391F20531F3ACAB10044EEC0 /* AppDelegate.swift in Sources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | 395217721F3AA61A00F8AF09 /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | 395217831F3AA62600F8AF09 /* LimitButtonSelect.swift in Sources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXSourcesBuildPhase section */ 224 | 225 | /* Begin PBXVariantGroup section */ 226 | 391F20561F3ACAB10044EEC0 /* Main.storyboard */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 391F20571F3ACAB10044EEC0 /* Base */, 230 | ); 231 | name = Main.storyboard; 232 | sourceTree = ""; 233 | }; 234 | 391F205B1F3ACAB10044EEC0 /* LaunchScreen.storyboard */ = { 235 | isa = PBXVariantGroup; 236 | children = ( 237 | 391F205C1F3ACAB10044EEC0 /* Base */, 238 | ); 239 | name = LaunchScreen.storyboard; 240 | sourceTree = ""; 241 | }; 242 | /* End PBXVariantGroup section */ 243 | 244 | /* Begin XCBuildConfiguration section */ 245 | 391F20601F3ACAB10044EEC0 /* Debug */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 249 | INFOPLIST_FILE = LimitSelectDemo/Info.plist; 250 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 251 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 252 | PRODUCT_BUNDLE_IDENTIFIER = com.kaskay.jeasungLee.LimitSelectDemo; 253 | PRODUCT_NAME = "$(TARGET_NAME)"; 254 | SWIFT_VERSION = 3.0; 255 | }; 256 | name = Debug; 257 | }; 258 | 391F20611F3ACAB10044EEC0 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 262 | INFOPLIST_FILE = LimitSelectDemo/Info.plist; 263 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 264 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 265 | PRODUCT_BUNDLE_IDENTIFIER = com.kaskay.jeasungLee.LimitSelectDemo; 266 | PRODUCT_NAME = "$(TARGET_NAME)"; 267 | SWIFT_VERSION = 3.0; 268 | }; 269 | name = Release; 270 | }; 271 | 3952177D1F3AA61A00F8AF09 /* Debug */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | CLANG_ANALYZER_NONNULL = YES; 276 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BOOL_CONVERSION = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 284 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 285 | CLANG_WARN_EMPTY_BODY = YES; 286 | CLANG_WARN_ENUM_CONVERSION = YES; 287 | CLANG_WARN_INFINITE_RECURSION = YES; 288 | CLANG_WARN_INT_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 294 | COPY_PHASE_STRIP = NO; 295 | CURRENT_PROJECT_VERSION = 1; 296 | DEBUG_INFORMATION_FORMAT = dwarf; 297 | ENABLE_STRICT_OBJC_MSGSEND = YES; 298 | ENABLE_TESTABILITY = YES; 299 | GCC_C_LANGUAGE_STANDARD = gnu99; 300 | GCC_DYNAMIC_NO_PIC = NO; 301 | GCC_NO_COMMON_BLOCKS = YES; 302 | GCC_OPTIMIZATION_LEVEL = 0; 303 | GCC_PREPROCESSOR_DEFINITIONS = ( 304 | "DEBUG=1", 305 | "$(inherited)", 306 | ); 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 314 | MTL_ENABLE_DEBUG_INFO = YES; 315 | ONLY_ACTIVE_ARCH = YES; 316 | SDKROOT = iphoneos; 317 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 318 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 319 | TARGETED_DEVICE_FAMILY = "1,2"; 320 | VERSIONING_SYSTEM = "apple-generic"; 321 | VERSION_INFO_PREFIX = ""; 322 | }; 323 | name = Debug; 324 | }; 325 | 3952177E1F3AA61A00F8AF09 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_ANALYZER_NONNULL = YES; 330 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 338 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 339 | CLANG_WARN_EMPTY_BODY = YES; 340 | CLANG_WARN_ENUM_CONVERSION = YES; 341 | CLANG_WARN_INFINITE_RECURSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | CURRENT_PROJECT_VERSION = 1; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = iphoneos; 364 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 365 | TARGETED_DEVICE_FAMILY = "1,2"; 366 | VALIDATE_PRODUCT = YES; 367 | VERSIONING_SYSTEM = "apple-generic"; 368 | VERSION_INFO_PREFIX = ""; 369 | }; 370 | name = Release; 371 | }; 372 | 395217801F3AA61A00F8AF09 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | CLANG_ENABLE_MODULES = YES; 376 | CODE_SIGN_IDENTITY = ""; 377 | DEFINES_MODULE = YES; 378 | DYLIB_COMPATIBILITY_VERSION = 1; 379 | DYLIB_CURRENT_VERSION = 1; 380 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 381 | INFOPLIST_FILE = LimitButtonSelect/Info.plist; 382 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 383 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 385 | PRODUCT_BUNDLE_IDENTIFIER = com.kaskay.jeasungLee.LimitButtonSelect; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | SKIP_INSTALL = YES; 388 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 389 | SWIFT_VERSION = 3.0; 390 | }; 391 | name = Debug; 392 | }; 393 | 395217811F3AA61A00F8AF09 /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | CLANG_ENABLE_MODULES = YES; 397 | CODE_SIGN_IDENTITY = ""; 398 | DEFINES_MODULE = YES; 399 | DYLIB_COMPATIBILITY_VERSION = 1; 400 | DYLIB_CURRENT_VERSION = 1; 401 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 402 | INFOPLIST_FILE = LimitButtonSelect/Info.plist; 403 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 404 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 406 | PRODUCT_BUNDLE_IDENTIFIER = com.kaskay.jeasungLee.LimitButtonSelect; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | SKIP_INSTALL = YES; 409 | SWIFT_VERSION = 3.0; 410 | }; 411 | name = Release; 412 | }; 413 | /* End XCBuildConfiguration section */ 414 | 415 | /* Begin XCConfigurationList section */ 416 | 391F205F1F3ACAB10044EEC0 /* Build configuration list for PBXNativeTarget "LimitSelectDemo" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 391F20601F3ACAB10044EEC0 /* Debug */, 420 | 391F20611F3ACAB10044EEC0 /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | 395217711F3AA61A00F8AF09 /* Build configuration list for PBXProject "LimitButtonSelect" */ = { 426 | isa = XCConfigurationList; 427 | buildConfigurations = ( 428 | 3952177D1F3AA61A00F8AF09 /* Debug */, 429 | 3952177E1F3AA61A00F8AF09 /* Release */, 430 | ); 431 | defaultConfigurationIsVisible = 0; 432 | defaultConfigurationName = Release; 433 | }; 434 | 3952177F1F3AA61A00F8AF09 /* Build configuration list for PBXNativeTarget "LimitButtonSelect" */ = { 435 | isa = XCConfigurationList; 436 | buildConfigurations = ( 437 | 395217801F3AA61A00F8AF09 /* Debug */, 438 | 395217811F3AA61A00F8AF09 /* Release */, 439 | ); 440 | defaultConfigurationIsVisible = 0; 441 | defaultConfigurationName = Release; 442 | }; 443 | /* End XCConfigurationList section */ 444 | }; 445 | rootObject = 3952176E1F3AA61A00F8AF09 /* Project object */; 446 | } 447 | -------------------------------------------------------------------------------- /LimitButtonSelect.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LimitButtonSelect.xcodeproj/xcuserdata/jeasung.lee.xcuserdatad/xcschemes/LimitButtonSelect.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /LimitButtonSelect.xcodeproj/xcuserdata/jeasung.lee.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LimitButtonSelect.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | LimitSelectDemo.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 391F20371F3AC9660044EEC0 21 | 22 | primary 23 | 24 | 25 | 391F204F1F3ACAB10044EEC0 26 | 27 | primary 28 | 29 | 30 | 395217761F3AA61A00F8AF09 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /LimitButtonSelect/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LimitButtonSelect/LimitButtonSelect.h: -------------------------------------------------------------------------------- 1 | // 2 | // LimitButtonSelect.h 3 | // LimitButtonSelect 4 | // 5 | // Created by jeasung.lee on 2017. 8. 9.. 6 | // Copyright © 2017년 jeasung.lee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for LimitButtonSelect. 12 | FOUNDATION_EXPORT double LimitButtonSelectVersionNumber; 13 | 14 | //! Project version string for LimitButtonSelect. 15 | FOUNDATION_EXPORT const unsigned char LimitButtonSelectVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /LimitButtonSelect/LimitButtonSelect.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LimitButtonSelect.swift 3 | // LimitButtonSelect 4 | // 5 | // Created by jeasung.lee on 2017. 8. 9.. 6 | // Copyright © 2017년 jeasung.lee. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public struct LimitButtonSelect { 12 | var buttons = [UIButton]() 13 | var selectedButtons = [UIButton]() 14 | var index: Int = 0 15 | var limit: Int = 1 16 | var selectCount: Int = 0 17 | 18 | public init(limit: Int, buttons: [UIButton]) { 19 | self.limit = limit 20 | self.buttons = buttons 21 | 22 | for _ in 0.. [UIButton] { 52 | var selected = [UIButton]() 53 | for index in 0..= limit { 78 | index = 0 79 | } 80 | } 81 | 82 | private mutating func deselectButton(button: UIButton) { 83 | buttonStatus(button: button, isSelected: false) 84 | guard let index = selectedButtons.index(of: button) else { return } 85 | selectedButtons.remove(at: index) 86 | selectedButtons.append(UIButton()) 87 | selectCount -= 1 88 | self.index = selectCount 89 | } 90 | 91 | private func isSelectable(_ loopElement: UIButton) -> Bool { 92 | return selectedButtons.contains(loopElement) 93 | } 94 | 95 | private func buttonControl(buttons: [UIButton]) { 96 | buttons.enumerated().forEach { 97 | buttonStatus(button: $0.element, isSelected: isSelectable($0.element)) 98 | } 99 | } 100 | 101 | private func buttonStatus(button: UIButton, isSelected: Bool) { 102 | button.isSelected = isSelected 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /LimitSelectDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LimitSelectDemo 4 | // 5 | // Created by jeasung.lee on 2017. 8. 9.. 6 | // Copyright © 2017년 jeasung.lee. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /LimitSelectDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LimitSelectDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LimitSelectDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 55 | 59 | 63 | 67 | 71 | 72 | 73 | 74 | 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 | 101 | -------------------------------------------------------------------------------- /LimitSelectDemo/Button.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Button.swift 3 | // LimitButtonSelect 4 | // 5 | // Created by jeasung.lee on 2017. 8. 9.. 6 | // Copyright © 2017년 jeasung.lee. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Button: UIButton { 12 | override func awakeFromNib() { 13 | super.awakeFromNib() 14 | } 15 | 16 | override var isSelected: Bool { 17 | didSet { 18 | if isSelected { 19 | changed() 20 | } else { 21 | normal() 22 | } 23 | } 24 | } 25 | 26 | func changed() { 27 | self.setTitle("Selected", for: .normal) 28 | self.backgroundColor = UIColor.red 29 | } 30 | 31 | func normal() { 32 | self.setTitle("Normal", for: .normal) 33 | self.backgroundColor = UIColor.white 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LimitSelectDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LimitSelectDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // LimitSelectDemo 4 | // 5 | // Created by jeasung.lee on 2017. 8. 9.. 6 | // Copyright © 2017년 jeasung.lee. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import LimitButtonSelect 11 | 12 | class ViewController: UIViewController { 13 | var limitButtonSelect : LimitButtonSelect! 14 | var limitButtonSelect2 : LimitButtonSelect! 15 | 16 | @IBOutlet var button1: Button! 17 | @IBOutlet var button2: Button! 18 | @IBOutlet var button3: Button! 19 | 20 | @IBOutlet var button4: Button! 21 | @IBOutlet var button5: Button! 22 | @IBOutlet var button6: Button! 23 | @IBOutlet var button7: Button! 24 | @IBOutlet var button8: Button! 25 | @IBOutlet var button9: Button! 26 | 27 | override func viewDidLoad() { 28 | super.viewDidLoad() 29 | 30 | limitButtonSelect = LimitButtonSelect(limit: 1, buttons: [button1, button2, button3]) 31 | limitButtonSelect2 = LimitButtonSelect(limit: 3, buttons: [button4, button5, button6, button7, button8, button9], defaultIndex: [2,4]) 32 | 33 | button1.addTarget(self, action: #selector(buttonClicked(_:)), for: .touchUpInside) 34 | button2.addTarget(self, action: #selector(buttonClicked(_:)), for: .touchUpInside) 35 | button3.addTarget(self, action: #selector(buttonClicked(_:)), for: .touchUpInside) 36 | 37 | button4.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 38 | button5.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 39 | button6.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 40 | button7.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 41 | button8.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 42 | button9.addTarget(self, action: #selector(buttonClicked2(_:)), for: .touchUpInside) 43 | } 44 | 45 | func buttonClicked(_ sender: UIButton) { 46 | limitButtonSelect.on(button: sender) 47 | } 48 | 49 | func buttonClicked2(_ sender: UIButton) { 50 | limitButtonSelect2.on(button: sender) 51 | } 52 | 53 | override func didReceiveMemoryWarning() { 54 | super.didReceiveMemoryWarning() 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LimitButtonSelect 2 | [![Version](https://img.shields.io/cocoapods/v/LimitButtonSelect.svg?style=flat)](http://cocoapods.org/pods/LimitButtonSelect) 3 | [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/younatics/Toggler/blob/master/LICENSE) 4 | [![Platform](https://img.shields.io/cocoapods/p/LimitButtonSelect.svg?style=flat)](http://cocoapods.org/pods/LimitButtonSelect) 5 | [![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat)](https://developer.apple.com/swift/) 6 | 7 | ## Intoduction 8 | ![demo](Image/limitButtonSelect.gif) 9 | ![demo](Image/limitButtonSelect2.gif) 10 | 11 | ## Requirements 12 | 13 | `LimitButtonSelect` is written in Swift 3. Compatible with iOS 9.0+ 14 | 15 | ## Usage 16 | 17 | The basic usage is to put the number of selectable buttons and buttons into an array. 18 | 19 | ```ruby 20 | limitButtonSelect = LimitButtonSelect(limit: 1, buttons: [button1, button2, button3]) 21 | ``` 22 | 23 | If you want to preselect it, you can use it as shown below. 24 | 25 | ```ruby 26 | limitButtonSelect2 = LimitButtonSelect(limit: 3, buttons: [button4, button5, button6, button7, button8, button9], defaultIndex: [2,4]) 27 | ``` 28 | 29 | When touching the button, use the on () method. 30 | ```ruby 31 | limitButtonSelect2.on(button: sender) 32 | ``` 33 | 34 | When you want to return selected buttons, you can use the selectedButton () method. 35 | ```ruby 36 | limitButtonSelect.selectedButton() 37 | ``` 38 | ## Installation 39 | 40 | ### Cocoapods 41 | 42 | LimitButtonSelect is available through [CocoaPods](http://cocoapods.org). To install 43 | it, simply add the following line to your Podfile: 44 | 45 | ```ruby 46 | pod 'LimitButtonSelect' 47 | ``` 48 | 49 | 50 | ## Author 51 | [kaskay](https://github.com/kaskay) 52 | 53 | ## License 54 | LimitButtonSelect is available under the MIT license. 55 | --------------------------------------------------------------------------------