├── .gitignore ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── Example ├── MultiToggleButtonDemo │ ├── Acknowledgement │ ├── clock.png │ ├── facebook.png │ ├── test_tube.png │ ├── camera-flash@2x.png │ ├── Info.plist │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── ToggleButtonDemo.swift ├── MultiToggleButtonDemo.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── project.pbxproj ├── MultiToggleButtonDemo.xcworkspace │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── contents.xcworkspacedata ├── Podfile.lock └── Podfile ├── screenshots └── toggle.gif ├── Sources ├── PrivacyInfo.xcprivacy └── MultiToggleButton.swift ├── Package.swift ├── MultiToggleButton.podspec ├── LICENSE.txt ├── CHANGELOG.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Example/Pods 2 | 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [yonat] 2 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/Acknowledgement: -------------------------------------------------------------------------------- 1 | Icons copyright information at www.Icons8.com -------------------------------------------------------------------------------- /screenshots/toggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonat/MultiToggleButton/HEAD/screenshots/toggle.gif -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonat/MultiToggleButton/HEAD/Example/MultiToggleButtonDemo/clock.png -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonat/MultiToggleButton/HEAD/Example/MultiToggleButtonDemo/facebook.png -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/test_tube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonat/MultiToggleButton/HEAD/Example/MultiToggleButtonDemo/test_tube.png -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/camera-flash@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonat/MultiToggleButton/HEAD/Example/MultiToggleButtonDemo/camera-flash@2x.png -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: yonat 7 | 8 | --- 9 | 10 | **Description:** 11 | [description] 12 | 13 | **Problems I encountered when trying to implement this myself:** 14 | [if none, please submit a pull request.] 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: yonat 7 | 8 | --- 9 | 10 | **Description of the problem:** 11 | [description] 12 | 13 | **Minimal project that reproduces the problem (so I'll be able to figure out how to fix it):** 14 | [link to a Minimal Reproducible Example as described at https://ootips.org/yonat/repex ] 15 | -------------------------------------------------------------------------------- /Sources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTracking 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | NSPrivacyAccessedAPITypes 10 | 11 | NSPrivacyTrackingDomains 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.6 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "MultiToggleButton", 7 | platforms: [ 8 | .iOS(.v11), 9 | ], 10 | products: [ 11 | .library(name: "MultiToggleButton", targets: ["MultiToggleButton"]), 12 | ], 13 | dependencies: [ 14 | .package(url: "https://github.com/yonat/SweeterSwift", from: "1.0.2"), 15 | ], 16 | targets: [ 17 | .target(name: "MultiToggleButton", dependencies: ["SweeterSwift"], path: "Sources", resources: [.process("PrivacyInfo.xcprivacy")]), 18 | ], 19 | swiftLanguageVersions: [.v5] 20 | ) 21 | -------------------------------------------------------------------------------- /MultiToggleButton.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "MultiToggleButton" 5 | s.version = "1.8.8" 6 | s.summary = "Multiple state tap to toggle UIButton in Swift" 7 | 8 | s.description = <<-DESC 9 | A UIButton subclass that implements tap-to-toggle button text. (Like the camera flash and timer buttons) 10 | DESC 11 | 12 | s.homepage = "https://github.com/yonat/MultiToggleButton" 13 | s.screenshots = "https://raw.githubusercontent.com/yonat/MultiToggleButton/master/screenshots/toggle.gif" 14 | 15 | s.license = { :type => "MIT", :file => "LICENSE.txt" } 16 | 17 | s.author = { "Yonat Sharon" => "yonat@ootips.org" } 18 | 19 | s.swift_versions = ['5.0'] 20 | s.platform = :ios, "11.0" 21 | s.requires_arc = true 22 | 23 | s.source = { :git => "https://github.com/yonat/MultiToggleButton.git", :tag => s.version } 24 | s.source_files = "Sources/*.swift" 25 | s.resource_bundles = {s.name => ['Sources/PrivacyInfo.xcprivacy']} 26 | end 27 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Yonat Sharon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MiniLayout (1.4.2) 3 | - MultiToggleButton (1.8.6) 4 | - SwiftFormat/CLI (0.52.11) 5 | - SwiftLint (0.54.0) 6 | - SwiftQuality (2.0.2): 7 | - SwiftFormat/CLI (= 0.52.11) 8 | - SwiftLint (= 0.54.0) 9 | 10 | DEPENDENCIES: 11 | - MiniLayout 12 | - MultiToggleButton (from `..`) 13 | - SwiftQuality (from `https://github.com/yonat/SwiftQuality`) 14 | 15 | SPEC REPOS: 16 | trunk: 17 | - MiniLayout 18 | - SwiftFormat 19 | - SwiftLint 20 | 21 | EXTERNAL SOURCES: 22 | MultiToggleButton: 23 | :path: ".." 24 | SwiftQuality: 25 | :git: https://github.com/yonat/SwiftQuality 26 | 27 | CHECKOUT OPTIONS: 28 | SwiftQuality: 29 | :commit: 330387800c520c05bc30a4eca825ba36f7a6e8df 30 | :git: https://github.com/yonat/SwiftQuality 31 | 32 | SPEC CHECKSUMS: 33 | MiniLayout: f819ad87432712e6b2596081a62e633a4961bfc6 34 | MultiToggleButton: e97074d9fbef80755f72ed3da3480eaa435e365c 35 | SwiftFormat: 2ca3d0b75754193f0f3ba532291f25ae08dd1e42 36 | SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211 37 | SwiftQuality: 3a5a16498170de064cb1e3e462551f8b1c3350a3 38 | 39 | PODFILE CHECKSUM: 6aa6e6e5e3a49e800ff50a7a47afb895e0339d98 40 | 41 | COCOAPODS: 1.15.2 42 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.8.8] - 2024-11-01 8 | 9 | ### Fixed 10 | - fix privacy manifest PrivacyInfo.xcprivacy. 11 | 12 | ## [1.8.7] - 2024-05-04 13 | 14 | ### Fixed 15 | - when the button image uses template rendering mode, use the same tint color as the button title color. 16 | 17 | ## [1.8.3] - 2023-08-19 18 | 19 | ### Added 20 | - add privacy manifest PrivacyInfo.xcprivacy. 21 | 22 | ## [1.8.2] - 2019-08-22 23 | 24 | ### Added 25 | - support Swift Package Manager. 26 | 27 | ## [1.8.1] - 2019-06-21 28 | 29 | ### Changed 30 | - Swift 5, CocoaPods 1.7. 31 | 32 | ## [1.8.0] - 2018-09-05 33 | 34 | ### Changed 35 | - Swift 4.2 36 | 37 | ## [1.7.1] - 2018-05-20 38 | 39 | ### Changed 40 | - use SwiftLint and SwiftFormat 41 | 42 | ## [1.7.0] - 2017-11-11 43 | 44 | ### Added 45 | - add `backgroundColors`. 46 | 47 | ## [1.6.0] - 2017-07-15 48 | 49 | ### Changed 50 | - Swift 4 51 | 52 | ## [1.5.2] - 2017-04-30 53 | 54 | ### Fixed 55 | - handle empty title and make the image in center. 56 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/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.8.3 19 | CFBundleVersion 20 | 51 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/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 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | pod 'MultiToggleButton', :path => '..' 2 | 3 | pod 'MiniLayout' 4 | pod 'SwiftQuality', :git => 'https://github.com/yonat/SwiftQuality' 5 | 6 | target 'MultiToggleButtonDemo' do 7 | script_phase :name => 'SwiftFormat', 8 | :execution_position => :before_compile, 9 | :script => 'if [[ "Debug" == "${CONFIGURATION}" && ! $ENABLE_PREVIEWS == "YES" ]]; then "${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat" --swiftversion ${SWIFT_VERSION} --config "${PODS_ROOT}/SwiftQuality/.swiftformat" "${SRCROOT}/.." ; fi' 10 | 11 | script_phase :name => 'SwiftLintAutocorrect', 12 | :execution_position => :before_compile, 13 | :script => 'if [[ "Debug" == "${CONFIGURATION}" && ! $ENABLE_PREVIEWS == "YES" ]]; then "${PODS_ROOT}/SwiftLint/swiftlint" --fix --config "${PODS_ROOT}/SwiftQuality/.swiftlint.yml" "${SRCROOT}/.." ; fi' 14 | 15 | script_phase :name => 'SwiftLint', 16 | :execution_position => :after_compile, 17 | :script => 'if [ "Debug" == "${CONFIGURATION}" && ! $ENABLE_PREVIEWS == "YES" ]; then "${PODS_ROOT}/SwiftLint/swiftlint" --config "${PODS_ROOT}/SwiftQuality/.swiftlint.yml" "${SRCROOT}/.." ; fi' 18 | end 19 | 20 | # Fix Xcode 14 warnings "Run script build phase '[CP] _____' will be run during every build because it does not specify any outputs." 21 | # Based on https://github.com/CocoaPods/CocoaPods/issues/11444#issuecomment-1300023416 22 | post_integrate do |installer| 23 | main_project = installer.aggregate_targets[0].user_project 24 | main_project.targets.each do |target| 25 | target.build_phases.each do |phase| 26 | next unless phase.is_a?(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) 27 | next unless phase.name.start_with?("[CP") 28 | next unless (phase.input_paths || []).empty? && (phase.output_paths || []).empty? 29 | phase.always_out_of_date = "1" 30 | end 31 | end 32 | main_project.save 33 | end 34 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo/ToggleButtonDemo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToggleButtonDemo.swift 3 | // ToggleButtonDemo 4 | // 5 | // Created by Yonat Sharon on 02.03.2015. 6 | // Copyright (c) 2015 Yonat Sharon. All rights reserved. 7 | // 8 | 9 | import MiniLayout 10 | import MultiToggleButton 11 | import UIKit 12 | 13 | class ToggleButtonViewController: UIViewController { 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | let toggleButton = MultiToggleButton( 17 | images: [ 18 | UIImage(named: "camera-flash"), 19 | UIImage(named: "facebook"), 20 | UIImage(named: "clock"), 21 | UIImage(named: "test_tube"), 22 | ], 23 | states: ["Toggle", "State", "Alter", "Color"], 24 | colors: [nil, nil, .gray, .red], 25 | backgroundColors: [nil, nil, .yellow, UIColor.lightGray.withAlphaComponent(0.25)] 26 | ) { button in 27 | print("Performing action for state: \(button.currentStateIndex)") 28 | } 29 | 30 | // make background coloring appear nicer 31 | toggleButton.contentEdgeInsets = UIEdgeInsets(top: 2, left: 8, bottom: 2, right: 8) 32 | toggleButton.layer.cornerRadius = 8 33 | 34 | view.addConstrainedSubview(toggleButton, constrain: .centerX, .centerY) 35 | } 36 | } 37 | 38 | @UIApplicationMain 39 | class ToggleButtonDemo: UIResponder, UIApplicationDelegate { 40 | var window: UIWindow? 41 | 42 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 43 | let window = UIWindow(frame: UIScreen.main.bounds) 44 | window.backgroundColor = UIColor.white 45 | window.rootViewController = ToggleButtonViewController() 46 | window.makeKeyAndVisible() 47 | self.window = window 48 | return true 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multiple State Toggle UIButton 2 | A UIButton subclass that implements tap-to-toggle button text. (Like the camera flash and timer buttons) 3 | 4 | 5 | [![Swift Version][swift-image]][swift-url] 6 | [![Build Status][travis-image]][travis-url] 7 | [![License][license-image]][license-url] 8 | [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/MultiToggleButton.svg)](https://img.shields.io/cocoapods/v/MultiToggleButton.svg) 9 | [![Platform](https://img.shields.io/cocoapods/p/MultiToggleButton.svg?style=flat)](http://cocoapods.org/pods/MultiToggleButton) 10 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 11 | 12 |

13 | 14 |

15 | 16 | ## Usage 17 | 18 | Just **create** it with the states, and it's good to go: 19 | 20 | ```swift 21 | let toggleButton = MultiToggleButton(image: myImage, states: ["First", "Second", "Last"]) 22 | ``` 23 | 24 | Get and set the **current state**: 25 | 26 | ```swift 27 | let state = toggleButton.currentStateIndex 28 | toggleButton.currentStateIndex = 0 29 | ``` 30 | 31 | Add a **tap action** (in addition to the built-in state toggle): 32 | 33 | ```swift 34 | toggleButton.action = { (sender) -> () in 35 | doStuff(sender.currentStateIndex) 36 | } 37 | ``` 38 | 39 | Set **different colors** for different states (`nil` uses the button's ```tintColor```): 40 | 41 | ```swift 42 | toggleButton.colors = [nil, .gray, .red] 43 | ``` 44 | 45 | Set **different images** for different states: 46 | 47 | ```swift 48 | toggleButton.images = [myFirstImage, mySecondImage, myLastImage] 49 | ``` 50 | 51 | Or do it **all at once**: 52 | 53 | ```swift 54 | let toggleButton = ToggleButton( 55 | images: [myFirstImage, mySecondImage, myLastImage], 56 | states: ["First", "Second", "Last"], 57 | colors: [nil, .gray, .red], 58 | action: { (sender) -> () in doStuff(sender.currentStateIndex) } 59 | ) 60 | ``` 61 | 62 | ## Installation 63 | 64 | ### CocoaPods: 65 | 66 | ```ruby 67 | pod 'MultiToggleButton' 68 | ``` 69 | 70 | Legacy versions: 71 | 72 | | Swift version | MultiToggleButton version | 73 | | :---: | :---: | 74 | | 4.0 (Xcode 9.4) | `pod 'MultiToggleButton', '~> 1.7.1'` | 75 | | 3 | `pod 'MultiToggleButton', '~> 1.5.2'` | 76 | | 2.3 | `pod 'MultiToggleButton', '~> 1.4.0'` | 77 | 78 | ### Swift Package Manager: 79 | 80 | ```swift 81 | dependencies: [ 82 | .package(url: "https://github.com/yonat/MultiToggleButton", from: "1.8.8") 83 | ] 84 | ``` 85 | 86 | ## Meta 87 | 88 | [@yonatsharon](https://twitter.com/yonatsharon) 89 | 90 | [https://github.com/yonat/MultiToggleButton](https://github.com/yonat/MultiToggleButton) 91 | 92 | [swift-image]:https://img.shields.io/badge/swift-4.2-orange.svg 93 | [swift-url]: https://swift.org/ 94 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg 95 | [license-url]: LICENSE.txt 96 | [travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square 97 | [travis-url]: https://travis-ci.org/dbader/node-datadog-metrics 98 | [codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad 99 | [codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com 100 | -------------------------------------------------------------------------------- /Sources/MultiToggleButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultiToggleButton.swift 3 | // Tap button to toggle label and/or image, like in camera flash and timer buttons. 4 | // 5 | // Created by Yonat Sharon on 02.03.2015. 6 | // Copyright (c) 2015 Yonat Sharon. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public typealias ToggleButton = MultiToggleButton // compatibility with old version 12 | 13 | open class MultiToggleButton: UIButton { 14 | /// use only this init, it's 'convenience' only to avoid overriding required inits 15 | public convenience init( 16 | images: [UIImage?], 17 | states: [String], 18 | colors: [UIColor?] = [], 19 | backgroundColors: [UIColor?] = [], 20 | action: ((_ sender: MultiToggleButton) -> Void)? = nil 21 | ) { 22 | self.init(frame: CGRect.zero) 23 | 24 | if let image = images.first { 25 | setImage(image, for: .normal) 26 | } 27 | sizeToFit() 28 | 29 | self.images = images 30 | self.states = states 31 | self.colors = colors 32 | self.backgroundColors = backgroundColors 33 | self.action = action 34 | addTarget(self, action: #selector(toggle), for: .touchUpInside) 35 | 36 | setupCurrentState() 37 | } 38 | 39 | public convenience init( 40 | image: UIImage?, 41 | states: [String], 42 | colors: [UIColor?] = [], 43 | backgroundColors: [UIColor?] = [], 44 | action: ((_ sender: MultiToggleButton) -> Void)? = nil 45 | ) { 46 | self.init(images: [image], states: states, colors: colors, backgroundColors: backgroundColors, action: action) 47 | } 48 | 49 | // MARK: - Manual Control 50 | 51 | @objc open func toggle() { 52 | currentStateIndex = (currentStateIndex + 1) % states.count 53 | action?(self) 54 | } 55 | 56 | @objc open var currentStateIndex: Int = 0 { didSet { setupCurrentState() } } 57 | open var colors: [UIColor?] = [] { didSet { setupCurrentState() } } 58 | open var backgroundColors: [UIColor?] = [] { didSet { setupCurrentState() } } 59 | open var images: [UIImage?] = [] { didSet { setupCurrentState() } } 60 | @objc open var states: [String] = [] { 61 | didSet { 62 | currentStateIndex %= states.count 63 | setupCurrentState() 64 | } 65 | } 66 | 67 | @objc open var action: ((_ sender: MultiToggleButton) -> Void)? { 68 | didSet { 69 | addTarget(self, action: #selector(toggle), for: .touchUpInside) 70 | } 71 | } 72 | 73 | // MARK: - Overrides 74 | 75 | override open func tintColorDidChange() { 76 | if nil == currentColor { 77 | setTitleColor(tintColor, for: .normal) 78 | } 79 | } 80 | 81 | // MARK: - Private 82 | 83 | private func setupCurrentState() { 84 | let currentTitle = states[currentStateIndex] 85 | setTitle(currentTitle.isEmpty ? nil : " " + currentTitle, for: .normal) 86 | setTitleColor(currentColor ?? tintColor, for: .normal) 87 | backgroundColor = currentBackgroundColor ?? .clear 88 | setImage(currentToggleImage ?? currentImage, for: .normal) 89 | imageView?.tintColor = titleColor(for: .normal) 90 | } 91 | 92 | private var currentColor: UIColor? { 93 | return currentStateIndex < colors.count ? colors[currentStateIndex] : nil 94 | } 95 | 96 | private var currentBackgroundColor: UIColor? { 97 | return currentStateIndex < backgroundColors.count ? backgroundColors[currentStateIndex] : nil 98 | } 99 | 100 | private var currentToggleImage: UIImage? { 101 | return currentStateIndex < images.count ? images[currentStateIndex] : nil 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Example/MultiToggleButtonDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C80F0FBCA622A8DC059D9697 /* libPods-MultiToggleButtonDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 534C533AA5B4026C4B0D559D /* libPods-MultiToggleButtonDemo.a */; }; 11 | DC5E611E1DE628A70063B0D8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC5E611C1DE628A70063B0D8 /* LaunchScreen.storyboard */; }; 12 | DC5E612A1DE6295E0063B0D8 /* camera-flash@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5E61251DE6295E0063B0D8 /* camera-flash@2x.png */; }; 13 | DC5E612B1DE6295E0063B0D8 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5E61261DE6295E0063B0D8 /* clock.png */; }; 14 | DC5E612C1DE6295E0063B0D8 /* facebook.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5E61271DE6295E0063B0D8 /* facebook.png */; }; 15 | DC5E612D1DE6295E0063B0D8 /* test_tube.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5E61281DE6295E0063B0D8 /* test_tube.png */; }; 16 | DC5E612E1DE6295E0063B0D8 /* ToggleButtonDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5E61291DE6295E0063B0D8 /* ToggleButtonDemo.swift */; }; 17 | DC8FD8EF22BCF9BF00E35EDB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = DC8FD8ED22BCF9BF00E35EDB /* README.md */; }; 18 | DC8FD8F022BCF9BF00E35EDB /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = DC8FD8EE22BCF9BF00E35EDB /* CHANGELOG.md */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 0A1E3D7EC9DEFAD305D7D0F0 /* Pods-MultiToggleButtonDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiToggleButtonDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-MultiToggleButtonDemo/Pods-MultiToggleButtonDemo.release.xcconfig"; sourceTree = ""; }; 23 | 534C533AA5B4026C4B0D559D /* libPods-MultiToggleButtonDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MultiToggleButtonDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | C353DD3F576DFDA6EA48A38D /* Pods-MultiToggleButtonDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiToggleButtonDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MultiToggleButtonDemo/Pods-MultiToggleButtonDemo.debug.xcconfig"; sourceTree = ""; }; 25 | DC5E61101DE628A70063B0D8 /* MultiToggleButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiToggleButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | DC5E611D1DE628A70063B0D8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | DC5E611F1DE628A70063B0D8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | DC5E61251DE6295E0063B0D8 /* camera-flash@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camera-flash@2x.png"; sourceTree = ""; }; 29 | DC5E61261DE6295E0063B0D8 /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = ""; }; 30 | DC5E61271DE6295E0063B0D8 /* facebook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facebook.png; sourceTree = ""; }; 31 | DC5E61281DE6295E0063B0D8 /* test_tube.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test_tube.png; sourceTree = ""; }; 32 | DC5E61291DE6295E0063B0D8 /* ToggleButtonDemo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleButtonDemo.swift; sourceTree = ""; }; 33 | DC8FD8ED22BCF9BF00E35EDB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 34 | DC8FD8EE22BCF9BF00E35EDB /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | DC5E610D1DE628A70063B0D8 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | C80F0FBCA622A8DC059D9697 /* libPods-MultiToggleButtonDemo.a in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 935C13C6E41231C23DF1592A /* Frameworks */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 534C533AA5B4026C4B0D559D /* libPods-MultiToggleButtonDemo.a */, 53 | ); 54 | name = Frameworks; 55 | sourceTree = ""; 56 | }; 57 | DC5E61071DE628A70063B0D8 = { 58 | isa = PBXGroup; 59 | children = ( 60 | DC8FD8ED22BCF9BF00E35EDB /* README.md */, 61 | DC8FD8EE22BCF9BF00E35EDB /* CHANGELOG.md */, 62 | DC5E61121DE628A70063B0D8 /* MultiToggleButtonDemo */, 63 | DC5E61111DE628A70063B0D8 /* Products */, 64 | EFCB9201B9C33CCF682EA739 /* Pods */, 65 | 935C13C6E41231C23DF1592A /* Frameworks */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | DC5E61111DE628A70063B0D8 /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | DC5E61101DE628A70063B0D8 /* MultiToggleButtonDemo.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | DC5E61121DE628A70063B0D8 /* MultiToggleButtonDemo */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | DC5E61251DE6295E0063B0D8 /* camera-flash@2x.png */, 81 | DC5E61261DE6295E0063B0D8 /* clock.png */, 82 | DC5E61271DE6295E0063B0D8 /* facebook.png */, 83 | DC5E61281DE6295E0063B0D8 /* test_tube.png */, 84 | DC5E61291DE6295E0063B0D8 /* ToggleButtonDemo.swift */, 85 | DC5E611C1DE628A70063B0D8 /* LaunchScreen.storyboard */, 86 | DC5E611F1DE628A70063B0D8 /* Info.plist */, 87 | ); 88 | path = MultiToggleButtonDemo; 89 | sourceTree = ""; 90 | }; 91 | EFCB9201B9C33CCF682EA739 /* Pods */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | C353DD3F576DFDA6EA48A38D /* Pods-MultiToggleButtonDemo.debug.xcconfig */, 95 | 0A1E3D7EC9DEFAD305D7D0F0 /* Pods-MultiToggleButtonDemo.release.xcconfig */, 96 | ); 97 | name = Pods; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | DC5E610F1DE628A70063B0D8 /* MultiToggleButtonDemo */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = DC5E61221DE628A70063B0D8 /* Build configuration list for PBXNativeTarget "MultiToggleButtonDemo" */; 106 | buildPhases = ( 107 | 7313476D0B2974DC65D83BB2 /* [CP] Check Pods Manifest.lock */, 108 | 0F485A05B912C8BA38ED0487 /* [CP-User] SwiftFormat */, 109 | 4E25180577CF59172A8FBF37 /* [CP-User] SwiftLintAutocorrect */, 110 | DC5E610C1DE628A70063B0D8 /* Sources */, 111 | DC5E610D1DE628A70063B0D8 /* Frameworks */, 112 | DC5E610E1DE628A70063B0D8 /* Resources */, 113 | FF418F68FBEB9ECC38263743 /* [CP-User] SwiftLint */, 114 | E54AA3C97E2BE308061CC988 /* [CP] Copy Pods Resources */, 115 | ); 116 | buildRules = ( 117 | ); 118 | dependencies = ( 119 | ); 120 | name = MultiToggleButtonDemo; 121 | productName = MultiToggleButtonDemo; 122 | productReference = DC5E61101DE628A70063B0D8 /* MultiToggleButtonDemo.app */; 123 | productType = "com.apple.product-type.application"; 124 | }; 125 | /* End PBXNativeTarget section */ 126 | 127 | /* Begin PBXProject section */ 128 | DC5E61081DE628A70063B0D8 /* Project object */ = { 129 | isa = PBXProject; 130 | attributes = { 131 | LastSwiftUpdateCheck = 0810; 132 | LastUpgradeCheck = 1020; 133 | ORGANIZATIONNAME = "Yonat Sharon"; 134 | TargetAttributes = { 135 | DC5E610F1DE628A70063B0D8 = { 136 | CreatedOnToolsVersion = 8.1; 137 | LastSwiftMigration = 1000; 138 | ProvisioningStyle = Automatic; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = DC5E610B1DE628A70063B0D8 /* Build configuration list for PBXProject "MultiToggleButtonDemo" */; 143 | compatibilityVersion = "Xcode 3.2"; 144 | developmentRegion = en; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | Base, 149 | ); 150 | mainGroup = DC5E61071DE628A70063B0D8; 151 | productRefGroup = DC5E61111DE628A70063B0D8 /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | DC5E610F1DE628A70063B0D8 /* MultiToggleButtonDemo */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | DC5E610E1DE628A70063B0D8 /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | DC8FD8EF22BCF9BF00E35EDB /* README.md in Resources */, 166 | DC5E612A1DE6295E0063B0D8 /* camera-flash@2x.png in Resources */, 167 | DC5E612C1DE6295E0063B0D8 /* facebook.png in Resources */, 168 | DC5E612B1DE6295E0063B0D8 /* clock.png in Resources */, 169 | DC5E612D1DE6295E0063B0D8 /* test_tube.png in Resources */, 170 | DC8FD8F022BCF9BF00E35EDB /* CHANGELOG.md in Resources */, 171 | DC5E611E1DE628A70063B0D8 /* LaunchScreen.storyboard in Resources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXResourcesBuildPhase section */ 176 | 177 | /* Begin PBXShellScriptBuildPhase section */ 178 | 0F485A05B912C8BA38ED0487 /* [CP-User] SwiftFormat */ = { 179 | isa = PBXShellScriptBuildPhase; 180 | alwaysOutOfDate = 1; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | ); 184 | name = "[CP-User] SwiftFormat"; 185 | runOnlyForDeploymentPostprocessing = 0; 186 | shellPath = /bin/sh; 187 | shellScript = "if [[ \"Debug\" == \"${CONFIGURATION}\" && ! $ENABLE_PREVIEWS == \"YES\" ]]; then \"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" --swiftversion ${SWIFT_VERSION} --config \"${PODS_ROOT}/SwiftQuality/.swiftformat\" \"${SRCROOT}/..\" ; fi"; 188 | showEnvVarsInLog = 0; 189 | }; 190 | 4E25180577CF59172A8FBF37 /* [CP-User] SwiftLintAutocorrect */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | alwaysOutOfDate = 1; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | name = "[CP-User] SwiftLintAutocorrect"; 197 | runOnlyForDeploymentPostprocessing = 0; 198 | shellPath = /bin/sh; 199 | shellScript = "if [[ \"Debug\" == \"${CONFIGURATION}\" && ! $ENABLE_PREVIEWS == \"YES\" ]]; then \"${PODS_ROOT}/SwiftLint/swiftlint\" --fix --config \"${PODS_ROOT}/SwiftQuality/.swiftlint.yml\" \"${SRCROOT}/..\" ; fi"; 200 | showEnvVarsInLog = 0; 201 | }; 202 | 7313476D0B2974DC65D83BB2 /* [CP] Check Pods Manifest.lock */ = { 203 | isa = PBXShellScriptBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | ); 207 | inputPaths = ( 208 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 209 | "${PODS_ROOT}/Manifest.lock", 210 | ); 211 | name = "[CP] Check Pods Manifest.lock"; 212 | outputPaths = ( 213 | "$(DERIVED_FILE_DIR)/Pods-MultiToggleButtonDemo-checkManifestLockResult.txt", 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | shellPath = /bin/sh; 217 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 218 | showEnvVarsInLog = 0; 219 | }; 220 | E54AA3C97E2BE308061CC988 /* [CP] Copy Pods Resources */ = { 221 | isa = PBXShellScriptBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | ); 225 | inputPaths = ( 226 | "${PODS_ROOT}/Target Support Files/Pods-MultiToggleButtonDemo/Pods-MultiToggleButtonDemo-resources.sh", 227 | "${PODS_CONFIGURATION_BUILD_DIR}/MultiToggleButton/MultiToggleButton.bundle", 228 | ); 229 | name = "[CP] Copy Pods Resources"; 230 | outputPaths = ( 231 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MultiToggleButton.bundle", 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | shellPath = /bin/sh; 235 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MultiToggleButtonDemo/Pods-MultiToggleButtonDemo-resources.sh\"\n"; 236 | showEnvVarsInLog = 0; 237 | }; 238 | FF418F68FBEB9ECC38263743 /* [CP-User] SwiftLint */ = { 239 | isa = PBXShellScriptBuildPhase; 240 | alwaysOutOfDate = 1; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | ); 244 | name = "[CP-User] SwiftLint"; 245 | runOnlyForDeploymentPostprocessing = 0; 246 | shellPath = /bin/sh; 247 | shellScript = "if [ \"Debug\" == \"${CONFIGURATION}\" && ! $ENABLE_PREVIEWS == \"YES\" ]; then \"${PODS_ROOT}/SwiftLint/swiftlint\" --config \"${PODS_ROOT}/SwiftQuality/.swiftlint.yml\" \"${SRCROOT}/..\" ; fi"; 248 | showEnvVarsInLog = 0; 249 | }; 250 | /* End PBXShellScriptBuildPhase section */ 251 | 252 | /* Begin PBXSourcesBuildPhase section */ 253 | DC5E610C1DE628A70063B0D8 /* Sources */ = { 254 | isa = PBXSourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | DC5E612E1DE6295E0063B0D8 /* ToggleButtonDemo.swift in Sources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | /* End PBXSourcesBuildPhase section */ 262 | 263 | /* Begin PBXVariantGroup section */ 264 | DC5E611C1DE628A70063B0D8 /* LaunchScreen.storyboard */ = { 265 | isa = PBXVariantGroup; 266 | children = ( 267 | DC5E611D1DE628A70063B0D8 /* Base */, 268 | ); 269 | name = LaunchScreen.storyboard; 270 | sourceTree = ""; 271 | }; 272 | /* End PBXVariantGroup section */ 273 | 274 | /* Begin XCBuildConfiguration section */ 275 | DC5E61201DE628A70063B0D8 /* Debug */ = { 276 | isa = XCBuildConfiguration; 277 | buildSettings = { 278 | ALWAYS_SEARCH_USER_PATHS = NO; 279 | CLANG_ANALYZER_NONNULL = YES; 280 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 281 | CLANG_CXX_LIBRARY = "libc++"; 282 | CLANG_ENABLE_MODULES = YES; 283 | CLANG_ENABLE_OBJC_ARC = YES; 284 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 285 | CLANG_WARN_BOOL_CONVERSION = YES; 286 | CLANG_WARN_COMMA = YES; 287 | CLANG_WARN_CONSTANT_CONVERSION = YES; 288 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 289 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 290 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INFINITE_RECURSION = YES; 294 | CLANG_WARN_INT_CONVERSION = YES; 295 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 296 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 297 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 299 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 300 | CLANG_WARN_STRICT_PROTOTYPES = YES; 301 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 302 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = dwarf; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | ENABLE_TESTABILITY = YES; 310 | GCC_C_LANGUAGE_STANDARD = gnu99; 311 | GCC_DYNAMIC_NO_PIC = NO; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_OPTIMIZATION_LEVEL = 0; 314 | GCC_PREPROCESSOR_DEFINITIONS = ( 315 | "DEBUG=1", 316 | "$(inherited)", 317 | ); 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 11; 325 | MTL_ENABLE_DEBUG_INFO = YES; 326 | ONLY_ACTIVE_ARCH = YES; 327 | SDKROOT = iphoneos; 328 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 329 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 330 | SWIFT_VERSION = 5.0; 331 | TARGETED_DEVICE_FAMILY = "1,2"; 332 | }; 333 | name = Debug; 334 | }; 335 | DC5E61211DE628A70063B0D8 /* Release */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_ANALYZER_NONNULL = YES; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 345 | CLANG_WARN_BOOL_CONVERSION = YES; 346 | CLANG_WARN_COMMA = YES; 347 | CLANG_WARN_CONSTANT_CONVERSION = YES; 348 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 357 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 360 | CLANG_WARN_STRICT_PROTOTYPES = YES; 361 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 362 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 363 | CLANG_WARN_UNREACHABLE_CODE = YES; 364 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 365 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 366 | COPY_PHASE_STRIP = NO; 367 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 368 | ENABLE_NS_ASSERTIONS = NO; 369 | ENABLE_STRICT_OBJC_MSGSEND = YES; 370 | GCC_C_LANGUAGE_STANDARD = gnu99; 371 | GCC_NO_COMMON_BLOCKS = YES; 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 11; 379 | MTL_ENABLE_DEBUG_INFO = NO; 380 | SDKROOT = iphoneos; 381 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 382 | SWIFT_VERSION = 5.0; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | VALIDATE_PRODUCT = YES; 385 | }; 386 | name = Release; 387 | }; 388 | DC5E61231DE628A70063B0D8 /* Debug */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = C353DD3F576DFDA6EA48A38D /* Pods-MultiToggleButtonDemo.debug.xcconfig */; 391 | buildSettings = { 392 | INFOPLIST_FILE = MultiToggleButtonDemo/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 394 | PRODUCT_BUNDLE_IDENTIFIER = com.roysharon.MultiToggleButtonDemo; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | }; 397 | name = Debug; 398 | }; 399 | DC5E61241DE628A70063B0D8 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | baseConfigurationReference = 0A1E3D7EC9DEFAD305D7D0F0 /* Pods-MultiToggleButtonDemo.release.xcconfig */; 402 | buildSettings = { 403 | INFOPLIST_FILE = MultiToggleButtonDemo/Info.plist; 404 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 405 | PRODUCT_BUNDLE_IDENTIFIER = com.roysharon.MultiToggleButtonDemo; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | }; 408 | name = Release; 409 | }; 410 | /* End XCBuildConfiguration section */ 411 | 412 | /* Begin XCConfigurationList section */ 413 | DC5E610B1DE628A70063B0D8 /* Build configuration list for PBXProject "MultiToggleButtonDemo" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | DC5E61201DE628A70063B0D8 /* Debug */, 417 | DC5E61211DE628A70063B0D8 /* Release */, 418 | ); 419 | defaultConfigurationIsVisible = 0; 420 | defaultConfigurationName = Release; 421 | }; 422 | DC5E61221DE628A70063B0D8 /* Build configuration list for PBXNativeTarget "MultiToggleButtonDemo" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | DC5E61231DE628A70063B0D8 /* Debug */, 426 | DC5E61241DE628A70063B0D8 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | /* End XCConfigurationList section */ 432 | }; 433 | rootObject = DC5E61081DE628A70063B0D8 /* Project object */; 434 | } 435 | --------------------------------------------------------------------------------