├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── LICENSE ├── Package.swift ├── README.md ├── SimpleAlert.podspec ├── SimpleAlert.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── SimpleAlert.xcscheme ├── SimpleAlert ├── AlertAction.swift ├── AlertContentView.swift ├── AlertContentView.xib ├── AlertController.swift ├── AlertController.xib ├── Extension │ ├── CGFloatExtension.swift │ ├── UIAlertControllerStyleExtension.swift │ ├── UIImageExtension.swift │ ├── UIStackViewExtension.swift │ └── UIViewExtension.swift ├── Info.plist ├── Info.swift ├── SimpleAlert.h ├── TextField.swift └── Transition │ ├── ActionSheetControllerDismissTransition.swift │ ├── ActionSheetControllerPresentTransition.swift │ ├── AlertControllerDismissTransition.swift │ ├── AlertControllerPresentTransition.swift │ └── ViewControllerAnimatedTransition.swift ├── SimpleAlertExample ├── SimpleAlertExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── SimpleAlertExample │ ├── AlertController.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── ContentViewController.swift │ ├── ContentViewController.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift └── SimpleAlertExampleTests │ ├── Info.plist │ └── SimpleAlertExampleTests.swift ├── SimpleAlertTests ├── Info.plist └── SimpleAlertTests.swift ├── Sources └── SimpleAlert │ └── SimpleAlert.swift └── Tests └── SimpleAlertTests └── SimpleAlertTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # mac 2 | .DS_Store 3 | 4 | # Xcode 5 | # 6 | build/ 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | *.xcuserstate 22 | 23 | # CocoaPods 24 | # 25 | # We recommend against adding the Pods directory to your .gitignore. However 26 | # you should judge for yourself, the pros and cons are mentioned at: 27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 28 | # 29 | # Pods/ 30 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kyohei Ito 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 | 23 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SimpleAlert", 8 | platforms: [.iOS(.v13)], 9 | products: [ 10 | // Products define the executables and libraries a package produces, and make them visible to other packages. 11 | .library( 12 | name: "SimpleAlert", 13 | targets: ["SimpleAlert"]), 14 | ], 15 | dependencies: [ 16 | // Dependencies declare other packages that this package depends on. 17 | // .package(url: /* package url */, from: "1.0.0"), 18 | ], 19 | targets: [ 20 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 21 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 22 | .target( 23 | name: "SimpleAlert", 24 | dependencies: [], path: "SimpleAlert"), 25 | .testTarget( 26 | name: "SimpleAlertTests", 27 | dependencies: ["SimpleAlert"]), 28 | ] 29 | ) 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimpleAlert 2 | 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![Version](https://img.shields.io/cocoapods/v/SimpleAlert.svg?style=flat)](http://cocoapods.org/pods/SimpleAlert) 5 | [![License](https://img.shields.io/cocoapods/l/SimpleAlert.svg?style=flat)](http://cocoapods.org/pods/SimpleAlert) 6 | [![Platform](https://img.shields.io/cocoapods/p/SimpleAlert.svg?style=flat)](http://cocoapods.org/pods/SimpleAlert) 7 | 8 | It is simple and easily customizable alert. 9 | Can be used as `UIAlertController`. 10 | 11 | #### [Appetize's Demo](https://appetize.io/app/w12zxu30gtr8p5a7v9t37gmzp4) 12 | 13 |

default_view 14 | custom_view 15 | custom_content 16 | rounded_view

17 | 18 | ## Requirements 19 | 20 | - Swift 5.0 21 | - iOS 9.0 or later 22 | 23 | ## How to Install SimpleAlert 24 | 25 | #### Cocoapods 26 | 27 | Add the following to your `Podfile`: 28 | 29 | ```Ruby 30 | pod "SimpleAlert" 31 | ``` 32 | 33 | #### Carthage 34 | 35 | Add the following to your `Cartfile`: 36 | 37 | ```Ruby 38 | github "KyoheiG3/SimpleAlert" 39 | ``` 40 | 41 | ## Usage 42 | 43 | ### Example 44 | 45 | View simple Alert 46 | 47 | ```Swift 48 | let alert = AlertController(title: "title", message: "message", style: .alert) 49 | 50 | alert.addTextField() 51 | alert.addAction(AlertAction(title: "Cancel", style: .cancel)) 52 | alert.addAction(AlertAction(title: "OK", style: .ok)) 53 | 54 | present(alert, animated: true, completion: nil) 55 | ``` 56 | 57 | Customize default contents 58 | 59 | ```Swift 60 | let alert = AlertController(title: "title", message: "message", style: .alert) 61 | alert.addTextField { textField in 62 | textField.frame.size.height = 33 63 | textField.backgroundColor = nil 64 | textField.layer.borderColor = nil 65 | textField.layer.borderWidth = 0 66 | } 67 | alert.configureContentView { view in 68 | view.titleLabel.textColor = UIColor.lightGrayColor() 69 | view.titleLabel.font = UIFont.boldSystemFontOfSize(30) 70 | view.messageLabel.textColor = UIColor.lightGrayColor() 71 | view.messageLabel.font = UIFont.boldSystemFontOfSize(16) 72 | view.textBackgroundView.layer.cornerRadius = 3.0 73 | view.textBackgroundView.clipsToBounds = true 74 | } 75 | 76 | alert.addAction(AlertAction(title: "Cancel", style: .cancel)) 77 | alert.addAction(AlertAction(title: "OK", style: .ok)) 78 | present(alert, animated: true, completion: nil) 79 | 80 | ``` 81 | 82 | Rounded button Alert View 83 | 84 | ```Swift 85 | let alert = AlertController(view: UIView(), style: .alert) 86 | alert.contentWidth = 144 87 | alert.contentCornerRadius = 72 88 | alert.contentColor = .white 89 | let action = AlertAction(title: "?", style: .cancel) { action in 90 | } 91 | 92 | alert.addAction(action) 93 | action.button.frame.size.height = 144 94 | action.button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 96) 95 | action.button.setTitleColor(UIColor.red, for: .normal) 96 | 97 | present(alert, animated: true, completion: nil) 98 | ``` 99 | 100 | More customizable if you create a subclass 101 | 102 | ```Swift 103 | class CustomAlertController: AlertController { 104 | override func addTextField(configurationHandler: ((UITextField) -> Void)? = nil) { 105 | super.addTextField { textField in 106 | textField.frame.size.height = 33 107 | textField.backgroundColor = nil 108 | textField.layer.borderColor = nil 109 | textField.layer.borderWidth = 0 110 | 111 | configurationHandler?(textField) 112 | } 113 | } 114 | 115 | override func configureActionButton(_ button: UIButton, at style :AlertAction.Style) { 116 | super.configureActionButton(button, at: style) 117 | 118 | switch style { 119 | case .ok: 120 | button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20) 121 | button.setTitleColor(UIColor.gray, for: UIControlState()) 122 | case .cancel: 123 | button.backgroundColor = UIColor.darkGray 124 | button.setTitleColor(UIColor.white, for: UIControlState()) 125 | case .default: 126 | button.setTitleColor(UIColor.lightGray, for: UIControlState()) 127 | default: 128 | break 129 | } 130 | } 131 | 132 | override func configureContentView(_ contentView: AlertContentView) { 133 | super.configureContentView(contentView) 134 | 135 | contentView.titleLabel.textColor = UIColor.lightGray 136 | contentView.titleLabel.font = UIFont.boldSystemFont(ofSize: 30) 137 | contentView.messageLabel.textColor = UIColor.lightGray 138 | contentView.messageLabel.font = UIFont.boldSystemFont(ofSize: 16) 139 | contentView.textBackgroundView.layer.cornerRadius = 10.0 140 | contentView.textBackgroundView.clipsToBounds = true 141 | } 142 | } 143 | ``` 144 | 145 | ## Class 146 | 147 | ### AlertAction 148 | 149 | #### Style 150 | 151 | - default 152 | - ok 153 | - cancel 154 | - destructive 155 | 156 | #### Initialize 157 | 158 | ```Swift 159 | init(title: String, style: SimpleAlert.AlertAction.Style, dismissesAlert: Bool = default, handler: ((SimpleAlert.AlertAction?) -> Swift.Void)? = default) 160 | ``` 161 | - Set title and style, can add button. 162 | - Set button action handler. 163 | 164 | #### Variable 165 | 166 | ```Swift 167 | var isEnabled: Bool 168 | ``` 169 | - Set button enabled. 170 | 171 | ```Swift 172 | let button: UIButton 173 | ``` 174 | - Can get a button. 175 | - Can get after button has been added to the `AlertController`. 176 | 177 | ### AlertContentView 178 | 179 | `backgroundColor` of `AlertContentView` will be reflected in the overall `backgroundColor`. 180 | 181 | ```Swift 182 | var baseView: UIView! 183 | ``` 184 | - Base view for contents 185 | 186 | ```Swift 187 | var titleLabel: UILabel! 188 | ``` 189 | - Title label 190 | 191 | ```Swift 192 | var messageLabel: UILabel! 193 | ``` 194 | - Message Label 195 | 196 | ```Swift 197 | var textBackgroundView: UIView! 198 | ``` 199 | - Base view for Text Field 200 | - `UIAlertControllerStyle` is in the case of `actionSheet` does not appear. 201 | 202 | ### AlertController 203 | 204 | #### Initialize 205 | 206 | ```Swift 207 | init(title: String?, message: String?, style: UIAlertControllerStyle) 208 | ``` 209 | - Set title, message and style, can add button. 210 | - Set button action handler. 211 | 212 | ```Swift 213 | init(title: String? = default, message: String? = default, view: UIView?, style: UIAlertControllerStyle) 214 | ``` 215 | - Can also set custom view. 216 | 217 | #### Variable 218 | 219 | ```Swift 220 | open var contentWidth: CGFloat 221 | open var contentColor: UIColor? 222 | open var contentCornerRadius: CGFloat? 223 | open var coverColor: UIColor 224 | open var message: String? 225 | ``` 226 | - Can change alert style. 227 | 228 | ```Swift 229 | public private(set) var actions: [SimpleAlert.AlertAction] 230 | public var textFields: [UITextField] { get } 231 | ``` 232 | - Can get actions and text fields that is added. 233 | 234 | #### Function 235 | 236 | ```Swift 237 | func addTextField(configurationHandler: ((UITextField) -> Swift.Void)? = default) 238 | ``` 239 | 240 | - Add Text Field, and set handler. 241 | - `UIAlertControllerStyle` is in the case of `actionSheet` does not add. 242 | 243 | ```Swift 244 | func addAction(_ action: SimpleAlert.AlertAction) 245 | ``` 246 | - Add action button. 247 | 248 | ```Swift 249 | func configureActionButton(_ button: UIButton, at style: SimpleAlert.AlertAction.Style) 250 | ``` 251 | - Override if would like to configure action button. 252 | 253 | ```Swift 254 | func configureContentView(_ contentView: SimpleAlert.AlertContentView) 255 | ``` 256 | - Override if would like to configure content view. 257 | 258 | ## The difference between default `UIAlertController` 259 | 260 | - Can add a cancel button any number of the `actionSheet`. 261 | - If tap the outside of the view, the action handler will not be executed of the `actionSheet`. 262 | 263 | ## Author 264 | 265 | #### Kyohei Ito 266 | 267 | - [GitHub](https://github.com/kyoheig3) 268 | - [Twitter](https://twitter.com/kyoheig3) 269 | 270 | Follow me 🎉 271 | 272 | ## LICENSE 273 | 274 | Under the MIT license. See [LICENSE](./LICENSE) file for details. 275 | -------------------------------------------------------------------------------- /SimpleAlert.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "SimpleAlert" 3 | s.version = "5.1.0" 4 | s.summary = "Simply Alert for Swift" 5 | s.homepage = "https://github.com/KyoheiG3/SimpleAlert" 6 | s.license = { :type => 'MIT', :file => 'LICENSE' } 7 | s.author = { "Kyohei Ito" => "je.suis.kyohei@gmail.com" } 8 | s.swift_version = '5.0' 9 | s.platform = :ios, "9.0" 10 | s.source = { :git => "https://github.com/KyoheiG3/SimpleAlert.git", :tag => s.version.to_s } 11 | s.source_files = "SimpleAlert/**/*.{h,swift,xib}" 12 | s.requires_arc = true 13 | s.frameworks = 'UIKit' 14 | end 15 | -------------------------------------------------------------------------------- /SimpleAlert.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C70C0C3E1A5FBEC8002BC071 /* SimpleAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = C70C0C3D1A5FBEC8002BC071 /* SimpleAlert.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | C70C0C441A5FBEC8002BC071 /* SimpleAlert.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C70C0C381A5FBEC8002BC071 /* SimpleAlert.framework */; }; 12 | C70C0C4B1A5FBEC8002BC071 /* SimpleAlertTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0C4A1A5FBEC8002BC071 /* SimpleAlertTests.swift */; }; 13 | C70C0C571A5FBFB4002BC071 /* AlertContentView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C70C0C551A5FBFB4002BC071 /* AlertContentView.xib */; }; 14 | C7453D5F1D868B96004E13BD /* AlertAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7453D5E1D868B96004E13BD /* AlertAction.swift */; }; 15 | C7453D611D868C30004E13BD /* AlertContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7453D601D868C30004E13BD /* AlertContentView.swift */; }; 16 | C75D875D1FC80357003592E3 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D875C1FC80357003592E3 /* TextField.swift */; }; 17 | C75D87631FC88148003592E3 /* CGFloatExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87621FC88148003592E3 /* CGFloatExtension.swift */; }; 18 | C75D87651FC88175003592E3 /* Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87641FC88175003592E3 /* Info.swift */; }; 19 | C75D87671FC995D2003592E3 /* ViewControllerAnimatedTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87661FC995D2003592E3 /* ViewControllerAnimatedTransition.swift */; }; 20 | C75D87751FC99726003592E3 /* ActionSheetControllerPresentTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87721FC99725003592E3 /* ActionSheetControllerPresentTransition.swift */; }; 21 | C75D87771FC99726003592E3 /* ActionSheetControllerDismissTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87741FC99725003592E3 /* ActionSheetControllerDismissTransition.swift */; }; 22 | C75D877A1FC99730003592E3 /* AlertControllerDismissTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87781FC99730003592E3 /* AlertControllerDismissTransition.swift */; }; 23 | C75D877B1FC99730003592E3 /* AlertControllerPresentTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D87791FC99730003592E3 /* AlertControllerPresentTransition.swift */; }; 24 | C75D877D1FC997F0003592E3 /* UIViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D877C1FC997F0003592E3 /* UIViewExtension.swift */; }; 25 | C75D87801FCBD996003592E3 /* UIAlertControllerStyleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75D877F1FCBD996003592E3 /* UIAlertControllerStyleExtension.swift */; }; 26 | C78B849222B2991900DC995A /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78B849022B2991900DC995A /* AlertController.swift */; }; 27 | C78B849322B2991900DC995A /* AlertController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C78B849122B2991900DC995A /* AlertController.xib */; }; 28 | C78B849A22B4980600DC995A /* UIStackViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78B849922B4980500DC995A /* UIStackViewExtension.swift */; }; 29 | C78B849C22B498BE00DC995A /* UIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78B849B22B498BE00DC995A /* UIImageExtension.swift */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | C70C0C451A5FBEC8002BC071 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = C70C0C2F1A5FBEC8002BC071 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = C70C0C371A5FBEC8002BC071; 38 | remoteInfo = SimpleAlert; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | C70C0C381A5FBEC8002BC071 /* SimpleAlert.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SimpleAlert.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | C70C0C3C1A5FBEC8002BC071 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | C70C0C3D1A5FBEC8002BC071 /* SimpleAlert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleAlert.h; sourceTree = ""; }; 46 | C70C0C431A5FBEC8002BC071 /* SimpleAlertTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleAlertTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | C70C0C491A5FBEC8002BC071 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | C70C0C4A1A5FBEC8002BC071 /* SimpleAlertTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleAlertTests.swift; sourceTree = ""; }; 49 | C70C0C551A5FBFB4002BC071 /* AlertContentView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AlertContentView.xib; sourceTree = ""; }; 50 | C7453D5E1D868B96004E13BD /* AlertAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertAction.swift; sourceTree = ""; }; 51 | C7453D601D868C30004E13BD /* AlertContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertContentView.swift; sourceTree = ""; }; 52 | C75D875C1FC80357003592E3 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; 53 | C75D87621FC88148003592E3 /* CGFloatExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGFloatExtension.swift; sourceTree = ""; }; 54 | C75D87641FC88175003592E3 /* Info.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = ""; }; 55 | C75D87661FC995D2003592E3 /* ViewControllerAnimatedTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerAnimatedTransition.swift; sourceTree = ""; }; 56 | C75D87721FC99725003592E3 /* ActionSheetControllerPresentTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetControllerPresentTransition.swift; sourceTree = ""; }; 57 | C75D87741FC99725003592E3 /* ActionSheetControllerDismissTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetControllerDismissTransition.swift; sourceTree = ""; }; 58 | C75D87781FC99730003592E3 /* AlertControllerDismissTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertControllerDismissTransition.swift; sourceTree = ""; }; 59 | C75D87791FC99730003592E3 /* AlertControllerPresentTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertControllerPresentTransition.swift; sourceTree = ""; }; 60 | C75D877C1FC997F0003592E3 /* UIViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExtension.swift; sourceTree = ""; }; 61 | C75D877F1FCBD996003592E3 /* UIAlertControllerStyleExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIAlertControllerStyleExtension.swift; sourceTree = ""; }; 62 | C78B849022B2991900DC995A /* AlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = ""; }; 63 | C78B849122B2991900DC995A /* AlertController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AlertController.xib; sourceTree = ""; }; 64 | C78B849922B4980500DC995A /* UIStackViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIStackViewExtension.swift; sourceTree = ""; }; 65 | C78B849B22B498BE00DC995A /* UIImageExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageExtension.swift; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | C70C0C341A5FBEC8002BC071 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | C70C0C401A5FBEC8002BC071 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | C70C0C441A5FBEC8002BC071 /* SimpleAlert.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | C70C0C2E1A5FBEC8002BC071 = { 88 | isa = PBXGroup; 89 | children = ( 90 | C70C0C3A1A5FBEC8002BC071 /* SimpleAlert */, 91 | C70C0C471A5FBEC8002BC071 /* SimpleAlertTests */, 92 | C70C0C391A5FBEC8002BC071 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | C70C0C391A5FBEC8002BC071 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | C70C0C381A5FBEC8002BC071 /* SimpleAlert.framework */, 100 | C70C0C431A5FBEC8002BC071 /* SimpleAlertTests.xctest */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | C70C0C3A1A5FBEC8002BC071 /* SimpleAlert */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | C78B849D22B498C300DC995A /* Extension */, 109 | C78B849422B33B1600DC995A /* Transition */, 110 | C7453D5E1D868B96004E13BD /* AlertAction.swift */, 111 | C7453D601D868C30004E13BD /* AlertContentView.swift */, 112 | C70C0C551A5FBFB4002BC071 /* AlertContentView.xib */, 113 | C70C0C3C1A5FBEC8002BC071 /* Info.plist */, 114 | C75D87641FC88175003592E3 /* Info.swift */, 115 | C70C0C3D1A5FBEC8002BC071 /* SimpleAlert.h */, 116 | C75D875C1FC80357003592E3 /* TextField.swift */, 117 | C78B849022B2991900DC995A /* AlertController.swift */, 118 | C78B849122B2991900DC995A /* AlertController.xib */, 119 | ); 120 | path = SimpleAlert; 121 | sourceTree = ""; 122 | }; 123 | C70C0C471A5FBEC8002BC071 /* SimpleAlertTests */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | C70C0C4A1A5FBEC8002BC071 /* SimpleAlertTests.swift */, 127 | C70C0C481A5FBEC8002BC071 /* Supporting Files */, 128 | ); 129 | path = SimpleAlertTests; 130 | sourceTree = ""; 131 | }; 132 | C70C0C481A5FBEC8002BC071 /* Supporting Files */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | C70C0C491A5FBEC8002BC071 /* Info.plist */, 136 | ); 137 | name = "Supporting Files"; 138 | sourceTree = ""; 139 | }; 140 | C78B849422B33B1600DC995A /* Transition */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | C75D87661FC995D2003592E3 /* ViewControllerAnimatedTransition.swift */, 144 | C75D87741FC99725003592E3 /* ActionSheetControllerDismissTransition.swift */, 145 | C75D87721FC99725003592E3 /* ActionSheetControllerPresentTransition.swift */, 146 | C75D87781FC99730003592E3 /* AlertControllerDismissTransition.swift */, 147 | C75D87791FC99730003592E3 /* AlertControllerPresentTransition.swift */, 148 | ); 149 | path = Transition; 150 | sourceTree = ""; 151 | }; 152 | C78B849D22B498C300DC995A /* Extension */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | C75D87621FC88148003592E3 /* CGFloatExtension.swift */, 156 | C75D877F1FCBD996003592E3 /* UIAlertControllerStyleExtension.swift */, 157 | C78B849922B4980500DC995A /* UIStackViewExtension.swift */, 158 | C78B849B22B498BE00DC995A /* UIImageExtension.swift */, 159 | C75D877C1FC997F0003592E3 /* UIViewExtension.swift */, 160 | ); 161 | path = Extension; 162 | sourceTree = ""; 163 | }; 164 | /* End PBXGroup section */ 165 | 166 | /* Begin PBXHeadersBuildPhase section */ 167 | C70C0C351A5FBEC8002BC071 /* Headers */ = { 168 | isa = PBXHeadersBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | C70C0C3E1A5FBEC8002BC071 /* SimpleAlert.h in Headers */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXHeadersBuildPhase section */ 176 | 177 | /* Begin PBXNativeTarget section */ 178 | C70C0C371A5FBEC8002BC071 /* SimpleAlert */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = C70C0C4E1A5FBEC8002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlert" */; 181 | buildPhases = ( 182 | C70C0C331A5FBEC8002BC071 /* Sources */, 183 | C70C0C341A5FBEC8002BC071 /* Frameworks */, 184 | C70C0C351A5FBEC8002BC071 /* Headers */, 185 | C70C0C361A5FBEC8002BC071 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | ); 191 | name = SimpleAlert; 192 | productName = SimpleAlert; 193 | productReference = C70C0C381A5FBEC8002BC071 /* SimpleAlert.framework */; 194 | productType = "com.apple.product-type.framework"; 195 | }; 196 | C70C0C421A5FBEC8002BC071 /* SimpleAlertTests */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = C70C0C511A5FBEC8002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertTests" */; 199 | buildPhases = ( 200 | C70C0C3F1A5FBEC8002BC071 /* Sources */, 201 | C70C0C401A5FBEC8002BC071 /* Frameworks */, 202 | C70C0C411A5FBEC8002BC071 /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | C70C0C461A5FBEC8002BC071 /* PBXTargetDependency */, 208 | ); 209 | name = SimpleAlertTests; 210 | productName = SimpleAlertTests; 211 | productReference = C70C0C431A5FBEC8002BC071 /* SimpleAlertTests.xctest */; 212 | productType = "com.apple.product-type.bundle.unit-test"; 213 | }; 214 | /* End PBXNativeTarget section */ 215 | 216 | /* Begin PBXProject section */ 217 | C70C0C2F1A5FBEC8002BC071 /* Project object */ = { 218 | isa = PBXProject; 219 | attributes = { 220 | LastSwiftUpdateCheck = 0700; 221 | LastUpgradeCheck = 1020; 222 | ORGANIZATIONNAME = kyohei_ito; 223 | TargetAttributes = { 224 | C70C0C371A5FBEC8002BC071 = { 225 | CreatedOnToolsVersion = 6.2; 226 | LastSwiftMigration = 1020; 227 | }; 228 | C70C0C421A5FBEC8002BC071 = { 229 | CreatedOnToolsVersion = 6.2; 230 | LastSwiftMigration = 0900; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = C70C0C321A5FBEC8002BC071 /* Build configuration list for PBXProject "SimpleAlert" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = en; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | ); 241 | mainGroup = C70C0C2E1A5FBEC8002BC071; 242 | productRefGroup = C70C0C391A5FBEC8002BC071 /* Products */; 243 | projectDirPath = ""; 244 | projectRoot = ""; 245 | targets = ( 246 | C70C0C371A5FBEC8002BC071 /* SimpleAlert */, 247 | C70C0C421A5FBEC8002BC071 /* SimpleAlertTests */, 248 | ); 249 | }; 250 | /* End PBXProject section */ 251 | 252 | /* Begin PBXResourcesBuildPhase section */ 253 | C70C0C361A5FBEC8002BC071 /* Resources */ = { 254 | isa = PBXResourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | C78B849322B2991900DC995A /* AlertController.xib in Resources */, 258 | C70C0C571A5FBFB4002BC071 /* AlertContentView.xib in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | C70C0C411A5FBEC8002BC071 /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXResourcesBuildPhase section */ 270 | 271 | /* Begin PBXSourcesBuildPhase section */ 272 | C70C0C331A5FBEC8002BC071 /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | C7453D611D868C30004E13BD /* AlertContentView.swift in Sources */, 277 | C78B849222B2991900DC995A /* AlertController.swift in Sources */, 278 | C7453D5F1D868B96004E13BD /* AlertAction.swift in Sources */, 279 | C75D87651FC88175003592E3 /* Info.swift in Sources */, 280 | C75D875D1FC80357003592E3 /* TextField.swift in Sources */, 281 | C75D877B1FC99730003592E3 /* AlertControllerPresentTransition.swift in Sources */, 282 | C75D87671FC995D2003592E3 /* ViewControllerAnimatedTransition.swift in Sources */, 283 | C75D87751FC99726003592E3 /* ActionSheetControllerPresentTransition.swift in Sources */, 284 | C78B849C22B498BE00DC995A /* UIImageExtension.swift in Sources */, 285 | C75D87771FC99726003592E3 /* ActionSheetControllerDismissTransition.swift in Sources */, 286 | C75D877D1FC997F0003592E3 /* UIViewExtension.swift in Sources */, 287 | C75D87801FCBD996003592E3 /* UIAlertControllerStyleExtension.swift in Sources */, 288 | C78B849A22B4980600DC995A /* UIStackViewExtension.swift in Sources */, 289 | C75D877A1FC99730003592E3 /* AlertControllerDismissTransition.swift in Sources */, 290 | C75D87631FC88148003592E3 /* CGFloatExtension.swift in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | C70C0C3F1A5FBEC8002BC071 /* Sources */ = { 295 | isa = PBXSourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | C70C0C4B1A5FBEC8002BC071 /* SimpleAlertTests.swift in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXTargetDependency section */ 305 | C70C0C461A5FBEC8002BC071 /* PBXTargetDependency */ = { 306 | isa = PBXTargetDependency; 307 | target = C70C0C371A5FBEC8002BC071 /* SimpleAlert */; 308 | targetProxy = C70C0C451A5FBEC8002BC071 /* PBXContainerItemProxy */; 309 | }; 310 | /* End PBXTargetDependency section */ 311 | 312 | /* Begin XCBuildConfiguration section */ 313 | C70C0C4C1A5FBEC8002BC071 /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | CURRENT_PROJECT_VERSION = 1; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | ENABLE_TESTABILITY = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_DYNAMIC_NO_PIC = NO; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_OPTIMIZATION_LEVEL = 0; 350 | GCC_PREPROCESSOR_DEFINITIONS = ( 351 | "DEBUG=1", 352 | "$(inherited)", 353 | ); 354 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 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 = 9.0; 362 | MTL_ENABLE_DEBUG_INFO = YES; 363 | ONLY_ACTIVE_ARCH = YES; 364 | SDKROOT = iphoneos; 365 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | VERSIONING_SYSTEM = "apple-generic"; 368 | VERSION_INFO_PREFIX = ""; 369 | }; 370 | name = Debug; 371 | }; 372 | C70C0C4D1A5FBEC8002BC071 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 382 | CLANG_WARN_BOOL_CONVERSION = YES; 383 | CLANG_WARN_COMMA = YES; 384 | CLANG_WARN_CONSTANT_CONVERSION = YES; 385 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INFINITE_RECURSION = YES; 390 | CLANG_WARN_INT_CONVERSION = YES; 391 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 393 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 394 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 395 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 396 | CLANG_WARN_STRICT_PROTOTYPES = YES; 397 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 398 | CLANG_WARN_UNREACHABLE_CODE = YES; 399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 400 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 401 | COPY_PHASE_STRIP = NO; 402 | CURRENT_PROJECT_VERSION = 1; 403 | ENABLE_NS_ASSERTIONS = NO; 404 | ENABLE_STRICT_OBJC_MSGSEND = YES; 405 | GCC_C_LANGUAGE_STANDARD = gnu99; 406 | GCC_NO_COMMON_BLOCKS = YES; 407 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 408 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 409 | GCC_WARN_UNDECLARED_SELECTOR = YES; 410 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 411 | GCC_WARN_UNUSED_FUNCTION = YES; 412 | GCC_WARN_UNUSED_VARIABLE = YES; 413 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 414 | MTL_ENABLE_DEBUG_INFO = NO; 415 | SDKROOT = iphoneos; 416 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 417 | TARGETED_DEVICE_FAMILY = "1,2"; 418 | VALIDATE_PRODUCT = YES; 419 | VERSIONING_SYSTEM = "apple-generic"; 420 | VERSION_INFO_PREFIX = ""; 421 | }; 422 | name = Release; 423 | }; 424 | C70C0C4F1A5FBEC8002BC071 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | CLANG_ENABLE_MODULES = YES; 428 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 429 | DEFINES_MODULE = YES; 430 | DYLIB_COMPATIBILITY_VERSION = 1; 431 | DYLIB_CURRENT_VERSION = 1; 432 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 433 | INFOPLIST_FILE = SimpleAlert/Info.plist; 434 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 436 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | SKIP_INSTALL = YES; 439 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 440 | SWIFT_VERSION = 5.0; 441 | }; 442 | name = Debug; 443 | }; 444 | C70C0C501A5FBEC8002BC071 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | CLANG_ENABLE_MODULES = YES; 448 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 449 | DEFINES_MODULE = YES; 450 | DYLIB_COMPATIBILITY_VERSION = 1; 451 | DYLIB_CURRENT_VERSION = 1; 452 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 453 | INFOPLIST_FILE = SimpleAlert/Info.plist; 454 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | SKIP_INSTALL = YES; 459 | SWIFT_VERSION = 5.0; 460 | }; 461 | name = Release; 462 | }; 463 | C70C0C521A5FBEC8002BC071 /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | GCC_PREPROCESSOR_DEFINITIONS = ( 467 | "DEBUG=1", 468 | "$(inherited)", 469 | ); 470 | INFOPLIST_FILE = SimpleAlertTests/Info.plist; 471 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 472 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 475 | SWIFT_VERSION = 4.0; 476 | }; 477 | name = Debug; 478 | }; 479 | C70C0C531A5FBEC8002BC071 /* Release */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | INFOPLIST_FILE = SimpleAlertTests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 487 | SWIFT_VERSION = 4.0; 488 | }; 489 | name = Release; 490 | }; 491 | /* End XCBuildConfiguration section */ 492 | 493 | /* Begin XCConfigurationList section */ 494 | C70C0C321A5FBEC8002BC071 /* Build configuration list for PBXProject "SimpleAlert" */ = { 495 | isa = XCConfigurationList; 496 | buildConfigurations = ( 497 | C70C0C4C1A5FBEC8002BC071 /* Debug */, 498 | C70C0C4D1A5FBEC8002BC071 /* Release */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | C70C0C4E1A5FBEC8002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlert" */ = { 504 | isa = XCConfigurationList; 505 | buildConfigurations = ( 506 | C70C0C4F1A5FBEC8002BC071 /* Debug */, 507 | C70C0C501A5FBEC8002BC071 /* Release */, 508 | ); 509 | defaultConfigurationIsVisible = 0; 510 | defaultConfigurationName = Release; 511 | }; 512 | C70C0C511A5FBEC8002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertTests" */ = { 513 | isa = XCConfigurationList; 514 | buildConfigurations = ( 515 | C70C0C521A5FBEC8002BC071 /* Debug */, 516 | C70C0C531A5FBEC8002BC071 /* Release */, 517 | ); 518 | defaultConfigurationIsVisible = 0; 519 | defaultConfigurationName = Release; 520 | }; 521 | /* End XCConfigurationList section */ 522 | }; 523 | rootObject = C70C0C2F1A5FBEC8002BC071 /* Project object */; 524 | } 525 | -------------------------------------------------------------------------------- /SimpleAlert.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimpleAlert.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleAlert.xcodeproj/xcshareddata/xcschemes/SimpleAlert.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 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /SimpleAlert/AlertAction.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertAction.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2016/09/12. 6 | // Copyright © 2016年 kyohei_ito. All rights reserved. 7 | // 8 | import UIKit 9 | 10 | open class AlertAction { 11 | public enum Style { 12 | case `default` 13 | case ok 14 | case cancel 15 | case destructive 16 | 17 | func font(of style: UIAlertController.Style) -> UIFont { 18 | switch self { 19 | case .cancel: 20 | return .boldSystemFont(ofSize: style.fontSize) 21 | default: 22 | return .systemFont(ofSize: style.fontSize) 23 | } 24 | } 25 | } 26 | 27 | public init(title: String, style: Style, shouldDismisses: Bool = true, handler: ((AlertAction?) -> Void)? = nil) { 28 | self.title = title 29 | self.handler = handler 30 | self.style = style 31 | self.shouldDismisses = shouldDismisses 32 | 33 | button.setTitle(title, for: .normal) 34 | button.setBackgroundImage(UIImage(color: .lightGray), for: .highlighted) 35 | } 36 | 37 | let title: String 38 | let handler: ((AlertAction) -> Void)? 39 | let style: Style 40 | let shouldDismisses: Bool 41 | public var button = UIButton(type: .system) 42 | public var isEnabled: Bool { 43 | get { return button.isEnabled } 44 | set { button.isEnabled = newValue } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SimpleAlert/AlertContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertContentView.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2016/09/12. 6 | // Copyright © 2016年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class AlertContentView: UIView { 12 | @IBOutlet public private(set) weak var contentStackView: UIStackView! 13 | @IBOutlet public private(set) weak var titleLabel: UILabel! { 14 | didSet { 15 | titleLabel.text = nil 16 | titleLabel.setContentCompressionResistancePriority(.required, for: .vertical) 17 | } 18 | } 19 | @IBOutlet public private(set) weak var messageLabel: UILabel! { 20 | didSet { 21 | messageLabel.text = nil 22 | messageLabel.setContentCompressionResistancePriority(.required, for: .vertical) 23 | } 24 | } 25 | @IBOutlet public private(set) weak var textBackgroundView: UIView! 26 | @IBOutlet private weak var textFieldView: UIView! 27 | @IBOutlet private weak var textFieldStackView: UIStackView! 28 | 29 | var textFields: [UITextField] { 30 | return textFieldStackView?.arrangedSubviews.compactMap { $0 as? UITextField } ?? [] 31 | } 32 | 33 | open override func layoutSubviews() { 34 | super.layoutSubviews() 35 | 36 | titleLabel.isHidden = titleLabel.text?.isEmpty ?? true 37 | messageLabel.isHidden = messageLabel.text?.isEmpty ?? true 38 | textFieldView.isHidden = textFields.isEmpty 39 | contentStackView.arrangedSubviews[0].isHidden = titleLabel.isHidden && messageLabel.isHidden && textFieldView.isHidden 40 | isHidden = contentStackView.arrangedSubviews.allSatisfy(\.isHidden) 41 | superview?.isHidden = isHidden 42 | 43 | let labelMaxLayoutWidth = bounds.width - 32 44 | titleLabel.preferredMaxLayoutWidth = labelMaxLayoutWidth 45 | messageLabel.preferredMaxLayoutWidth = labelMaxLayoutWidth 46 | } 47 | 48 | func append(_ textField: UITextField) { 49 | textFieldStackView.addArrangedSubview(textField) 50 | } 51 | 52 | func removeAllTextField() { 53 | textFieldStackView.removeAllArrangedSubviews() 54 | } 55 | 56 | public override init(frame: CGRect) { 57 | super.init(frame: frame) 58 | loadNibContent() 59 | } 60 | 61 | public required init?(coder aDecoder: NSCoder) { 62 | super.init(coder: aDecoder) 63 | loadNibContent() 64 | } 65 | 66 | private func loadNibContent() { 67 | let type = AlertContentView.self 68 | #if SWIFT_PACKAGE 69 | let bundle = Bundle.module 70 | #else 71 | let bundle = Bundle(for: type) 72 | #endif 73 | let nib = UINib(nibName: String(describing: type), bundle: bundle) 74 | if let view = nib.instantiate(withOwner: self, options: nil).first as? UIView { 75 | addSubview(view) 76 | view.translatesAutoresizingMaskIntoConstraints = false 77 | NSLayoutConstraint.activate([ 78 | view.topAnchor.constraint(equalTo: topAnchor), 79 | view.leftAnchor.constraint(equalTo: leftAnchor), 80 | view.rightAnchor.constraint(equalTo: rightAnchor), 81 | view.bottomAnchor.constraint(equalTo: bottomAnchor) 82 | ]) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /SimpleAlert/AlertContentView.xib: -------------------------------------------------------------------------------- 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 | 31 | 32 | 33 | 38 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /SimpleAlert/AlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertController.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2019/06/13. 6 | // Copyright © 2019 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class AlertController: UIViewController { 12 | enum Const { 13 | static let alertWidth: CGFloat = 270 14 | static let actionSheetMargin: CGFloat = 16 15 | static let cornerRadius: CGFloat = 13 16 | static let textFieldHeight: CGFloat = 25 17 | } 18 | 19 | @IBOutlet weak var containerView: UIView! { 20 | didSet { 21 | if preferredStyle == .actionSheet { 22 | tapGesture.addTarget(self, action: #selector(AlertController.backgroundViewTapAction(_:))) 23 | containerView.addGestureRecognizer(tapGesture) 24 | } 25 | } 26 | } 27 | 28 | @IBOutlet weak var containerStackView: UIStackView! 29 | 30 | @IBOutlet weak var contentEffectView: UIVisualEffectView! { 31 | didSet { 32 | contentEffectView.clipsToBounds = true 33 | } 34 | } 35 | 36 | @IBOutlet weak var cancelEffectView: UIVisualEffectView! { 37 | didSet { 38 | cancelEffectView.clipsToBounds = true 39 | cancelEffectView.isHidden = preferredStyle == .alert 40 | } 41 | } 42 | 43 | @IBOutlet weak var contentStackView: UIStackView! 44 | 45 | @IBOutlet weak var contentScrollView: UIScrollView! { 46 | didSet { 47 | contentScrollView.showsVerticalScrollIndicator = false 48 | contentScrollView.showsHorizontalScrollIndicator = false 49 | if #available(iOS 11.0, *) { 50 | contentScrollView.contentInsetAdjustmentBehavior = .never 51 | } 52 | } 53 | } 54 | 55 | @IBOutlet weak var alertButtonScrollView: UIScrollView! { 56 | didSet { 57 | alertButtonScrollView.showsVerticalScrollIndicator = false 58 | alertButtonScrollView.showsHorizontalScrollIndicator = false 59 | if #available(iOS 11.0, *) { 60 | alertButtonScrollView.contentInsetAdjustmentBehavior = .never 61 | } 62 | } 63 | } 64 | 65 | @IBOutlet weak var cancelButtonScrollView: UIScrollView! { 66 | didSet { 67 | alertButtonScrollView.showsVerticalScrollIndicator = false 68 | alertButtonScrollView.showsHorizontalScrollIndicator = false 69 | if #available(iOS 11.0, *) { 70 | cancelButtonScrollView.contentInsetAdjustmentBehavior = .never 71 | } 72 | } 73 | } 74 | 75 | @IBOutlet weak var alertContentView: AlertContentView! 76 | @IBOutlet weak var alertButtonStackView: UIStackView! 77 | @IBOutlet weak var cancelButtonStackView: UIStackView! 78 | 79 | @IBOutlet weak var containerViewBottom: NSLayoutConstraint! 80 | @IBOutlet weak var containerStackViewWidth: NSLayoutConstraint! 81 | 82 | public private(set) var actions: [AlertAction] = [] 83 | public private(set) var textFields: [UITextField] = [] 84 | 85 | open var contentWidth: CGFloat? 86 | open var contentColor: UIColor? 87 | open var contentCornerRadius: CGFloat? 88 | open var coverColor: UIColor = .black 89 | open var message: String? 90 | 91 | private var contentViewHandler: ((AlertContentView) -> Void)? 92 | private var customView: UIView? 93 | private var preferredStyle: UIAlertController.Style = .alert 94 | private let tapGesture = UITapGestureRecognizer() 95 | 96 | private weak var customViewHeightConstraint: NSLayoutConstraint? { 97 | didSet { 98 | oldValue?.isActive = false 99 | } 100 | } 101 | 102 | private weak var containerStackViewYAxisConstraint: NSLayoutConstraint? { 103 | didSet { 104 | oldValue?.isActive = false 105 | } 106 | } 107 | 108 | deinit { 109 | NotificationCenter.default.removeObserver(self) 110 | } 111 | 112 | private convenience init() { 113 | let type = AlertController.self 114 | #if SWIFT_PACKAGE 115 | let bundle = Bundle.module 116 | #else 117 | let bundle = Bundle(for: type) 118 | #endif 119 | self.init(nibName: String(describing: type), bundle: bundle) 120 | } 121 | 122 | public convenience init(title: String?, message: String?, style: UIAlertController.Style) { 123 | self.init() 124 | self.title = title 125 | self.message = message 126 | self.preferredStyle = style 127 | } 128 | 129 | public convenience init(title: String? = nil, message: String? = nil, view: UIView?, style: UIAlertController.Style) { 130 | self.init() 131 | self.title = title 132 | self.message = message 133 | customView = view 134 | preferredStyle = style 135 | } 136 | 137 | public required init?(coder aDecoder: NSCoder) { 138 | super.init(coder: aDecoder) 139 | } 140 | 141 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 142 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 143 | 144 | modalPresentationStyle = .custom 145 | modalTransitionStyle = .crossDissolve 146 | transitioningDelegate = self 147 | } 148 | 149 | open override func viewWillAppear(_ animated: Bool) { 150 | super.viewWillAppear(animated) 151 | 152 | if let color = contentColor { 153 | contentEffectView.backgroundColor = color 154 | cancelEffectView.backgroundColor = color 155 | contentEffectView.effect = nil 156 | cancelEffectView.effect = nil 157 | } else { 158 | contentEffectView.backgroundColor = .white 159 | cancelEffectView.backgroundColor = .white 160 | } 161 | 162 | contentEffectView.layer.cornerRadius = contentCornerRadius ?? Const.cornerRadius 163 | cancelEffectView.layer.cornerRadius = contentCornerRadius ?? Const.cornerRadius 164 | 165 | alertContentView.titleLabel.text = title 166 | alertContentView.messageLabel.text = message 167 | 168 | if preferredStyle == .alert { 169 | textFields.forEach { textField in 170 | alertContentView.append(textField) 171 | (textField as? TextField)?.handler?(textField) 172 | } 173 | 174 | textFields.first?.becomeFirstResponder() 175 | } 176 | 177 | if let view = customView { 178 | alertContentView.contentStackView.addArrangedSubview(view) 179 | } 180 | 181 | configureContentView(alertContentView) 182 | alertContentView.layoutIfNeeded() 183 | 184 | layoutButtons() 185 | 186 | view.layoutIfNeeded() 187 | NotificationCenter.default.addObserver(self, selector: #selector(AlertController.keyboardFrameWillChange), name: UIResponder.keyboardWillShowNotification, object: nil) 188 | NotificationCenter.default.addObserver(self, selector: #selector(AlertController.keyboardFrameWillChange), name: UIResponder.keyboardWillHideNotification, object: nil) 189 | } 190 | 191 | open override func viewWillDisappear(_ animated: Bool) { 192 | super.viewWillDisappear(animated) 193 | 194 | NotificationCenter.default.removeObserver(self) 195 | alertContentView.endEditing(true) 196 | } 197 | 198 | open override func viewDidDisappear(_ animated: Bool) { 199 | super.viewDidDisappear(animated) 200 | 201 | alertContentView.removeAllTextField() 202 | if let view = customView { 203 | alertContentView.contentStackView.removeArrangedSubview(view) 204 | view.removeFromSuperview() 205 | } 206 | alertButtonStackView.removeAllArrangedSubviews() 207 | cancelButtonStackView.removeAllArrangedSubviews() 208 | contentStackView.arrangedSubviews 209 | .filter { !($0 is UIScrollView) } 210 | .forEach { view in 211 | contentStackView.removeArrangedSubview(view) 212 | view.removeFromSuperview() 213 | } 214 | } 215 | 216 | open override func updateViewConstraints() { 217 | super.updateViewConstraints() 218 | 219 | customViewHeightConstraint?.isActive = false 220 | containerStackViewYAxisConstraint?.isActive = false 221 | 222 | let minWidth = min(view.bounds.width, view.bounds.height) 223 | containerStackViewWidth.constant = contentWidth ?? (preferredStyle == .alert ? Const.alertWidth : minWidth - Const.actionSheetMargin) 224 | 225 | let constraint: NSLayoutConstraint 226 | switch preferredStyle { 227 | case .alert: 228 | constraint = containerStackView.centerYAnchor.constraint(equalTo: containerView.centerYAnchor) 229 | 230 | case .actionSheet: 231 | let bottomAnchor: NSLayoutYAxisAnchor 232 | if #available(iOS 11.0, *) { 233 | bottomAnchor = containerView.safeAreaLayoutGuide.bottomAnchor 234 | } else { 235 | bottomAnchor = containerView.bottomAnchor 236 | } 237 | constraint = containerStackView.bottomAnchor.constraint(equalTo: bottomAnchor) 238 | 239 | @unknown default: 240 | constraint = containerStackView.centerYAnchor.constraint(equalTo: containerView.centerYAnchor) 241 | } 242 | 243 | constraint.priority = .defaultHigh 244 | constraint.isActive = true 245 | containerStackViewYAxisConstraint = constraint 246 | 247 | if let view = customView { 248 | let constraint = view.heightAnchor.constraint(equalToConstant: view.bounds.height) 249 | constraint.isActive = true 250 | customViewHeightConstraint = constraint 251 | } 252 | } 253 | 254 | open func addTextField(configurationHandler: ((UITextField) -> Void)? = nil) { 255 | let textField = TextField() 256 | textField.handler = configurationHandler 257 | textField.heightAnchor.constraint(equalToConstant: Const.textFieldHeight).isActive = true 258 | textFields.append(textField) 259 | } 260 | 261 | open func addAction(_ action: AlertAction) { 262 | action.button.frame.size.height = preferredStyle.buttonHeight 263 | action.button.addTarget(self, action: #selector(AlertController.buttonDidTap), for: .touchUpInside) 264 | 265 | configureActionButton(action.button, at: action.style) 266 | actions.append(action) 267 | } 268 | 269 | open func configureActionButton(_ button: UIButton, at style: AlertAction.Style) { 270 | if style == .destructive { 271 | button.setTitleColor(.red, for: .normal) 272 | } 273 | button.titleLabel?.font = style.font(of: preferredStyle) 274 | } 275 | 276 | open func configureContentView(_ contentView: AlertContentView) { 277 | contentViewHandler?(contentView) 278 | } 279 | 280 | @discardableResult 281 | public func configureContentView(configurationHandler: @escaping (AlertContentView) -> Void) -> Self { 282 | contentViewHandler = configurationHandler 283 | return self 284 | } 285 | } 286 | 287 | extension AlertController { 288 | func layoutButtons() { 289 | alertButtonStackView.axis = preferredStyle == .alert && actions.count == 2 ? .horizontal : .vertical 290 | 291 | switch (preferredStyle, alertButtonStackView.axis) { 292 | case (.actionSheet, _): 293 | actions.lazy 294 | .filter { $0.style != .cancel } 295 | .forEach(alertButtonStackView.addAction) 296 | actions.lazy 297 | .filter { $0.style == .cancel } 298 | .forEach(cancelButtonStackView.addAction) 299 | 300 | if alertContentView.isHidden, let borderView = alertButtonStackView.arrangedSubviews.first { 301 | alertButtonStackView.removeArrangedSubview(borderView) 302 | borderView.removeFromSuperview() 303 | } 304 | 305 | if let borderView = cancelButtonStackView.arrangedSubviews.first { 306 | cancelButtonStackView.removeArrangedSubview(borderView) 307 | borderView.removeFromSuperview() 308 | } 309 | 310 | case (.alert, .horizontal): 311 | actions.forEach(alertButtonStackView.addAction) 312 | 313 | if let borderView = alertButtonStackView.arrangedSubviews.first { 314 | alertButtonStackView.removeArrangedSubview(borderView) 315 | borderView.removeFromSuperview() 316 | } 317 | 318 | if !alertContentView.isHidden { 319 | contentStackView.insertArrangedSubview(contentStackView.makeBorderView(), at: 1) 320 | } 321 | 322 | case (.alert, .vertical): 323 | actions.forEach(alertButtonStackView.addAction) 324 | 325 | if alertContentView.isHidden, let borderView = alertButtonStackView.arrangedSubviews.first { 326 | alertButtonStackView.removeArrangedSubview(borderView) 327 | borderView.removeFromSuperview() 328 | } 329 | 330 | @unknown default: 331 | break 332 | } 333 | 334 | zip(actions, actions.dropFirst()).forEach { top, bottom in 335 | top.button.widthAnchor.constraint(equalTo: bottom.button.widthAnchor).isActive = true 336 | } 337 | } 338 | 339 | func dismiss(with sender: UIButton) { 340 | guard let action = actions.filter({ $0.button == sender }).first else { 341 | dismiss() 342 | return 343 | } 344 | if action.shouldDismisses { 345 | dismiss { 346 | action.handler?(action) 347 | } 348 | } else { 349 | action.handler?(action) 350 | } 351 | } 352 | 353 | func dismiss(withCompletion block: @escaping () -> Void = {}) { 354 | dismiss(animated: true) { 355 | block() 356 | self.actions.removeAll() 357 | self.textFields.removeAll() 358 | } 359 | } 360 | } 361 | 362 | // MARK: - Action Methods 363 | extension AlertController { 364 | @objc func buttonDidTap(_ button: UIButton) { 365 | dismiss(with: button) 366 | } 367 | 368 | @objc func backgroundViewTapAction(_ gesture: UITapGestureRecognizer) { 369 | if !containerStackView.frame.contains(gesture.location(in: containerView)) { 370 | dismiss() 371 | } 372 | } 373 | } 374 | 375 | // MARK: - NSNotificationCenter Methods 376 | extension AlertController { 377 | @objc func keyboardFrameWillChange(_ notification: Notification) { 378 | let info = notification.info 379 | if let frame = info.keyboardFrameEnd, 380 | let duration = info.duration, 381 | let curve = info.curve { 382 | 383 | UIView.animate(withDuration: duration, delay: 0, options: curve, animations: { 384 | self.containerViewBottom.constant = self.view.bounds.height - frame.origin.y 385 | self.view.layoutIfNeeded() 386 | }) 387 | } 388 | } 389 | } 390 | 391 | // MARK: - UIViewControllerTransitioningDelegate Methods 392 | extension AlertController: UIViewControllerTransitioningDelegate { 393 | public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 394 | switch preferredStyle { 395 | case .alert: 396 | return AlertControllerPresentTransition(backgroundColor: coverColor) 397 | case .actionSheet: 398 | return ActionSheetControllerPresentTransition(backgroundColor: coverColor) 399 | @unknown default: 400 | fatalError() 401 | } 402 | } 403 | 404 | public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 405 | switch preferredStyle { 406 | case .alert: 407 | return AlertControllerDismissTransition(backgroundColor: coverColor) 408 | case .actionSheet: 409 | return ActionSheetControllerDismissTransition(backgroundColor: coverColor) 410 | @unknown default: 411 | fatalError() 412 | } 413 | } 414 | } 415 | -------------------------------------------------------------------------------- /SimpleAlert/AlertController.xib: -------------------------------------------------------------------------------- 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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 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 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /SimpleAlert/Extension/CGFloatExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGFloatExtension.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Foundation 11 | 12 | extension CGFloat { 13 | static var thinWidth: CGFloat { 14 | return 1 / UIScreen.main.scale 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SimpleAlert/Extension/UIAlertControllerStyleExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertControllerStyleExtension.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/27. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | import UIKit 9 | 10 | extension UIAlertController.Style { 11 | var fontSize: CGFloat { 12 | switch self { 13 | case .alert: return 17 14 | case .actionSheet: return 21 15 | @unknown default: return 17 16 | } 17 | } 18 | 19 | var buttonHeight: CGFloat { 20 | switch self { 21 | case .alert: 22 | return 48 23 | case .actionSheet: 24 | if #available(iOS 9.0, *) { 25 | return 58 26 | } else { 27 | return 44 28 | } 29 | @unknown default: 30 | return 48 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleAlert/Extension/UIImageExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageExtension.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2019/06/15. 6 | // Copyright © 2019 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIImage { 12 | convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) { 13 | UIGraphicsBeginImageContextWithOptions(size, false, 1) 14 | let context = UIGraphicsGetCurrentContext() 15 | context?.setFillColor(color.cgColor) 16 | context?.fill(CGRect(origin: .zero, size: size)) 17 | 18 | defer { 19 | UIGraphicsEndImageContext() 20 | } 21 | 22 | guard let image = UIGraphicsGetImageFromCurrentImageContext(), let data = image.pngData() else { return nil } 23 | self.init(data: data, scale: image.scale) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SimpleAlert/Extension/UIStackViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIStackViewExtension.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2019/06/15. 6 | // Copyright © 2019 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIStackView { 12 | func makeBorderView() -> UIView { 13 | let borderView = UIView() 14 | borderView.translatesAutoresizingMaskIntoConstraints = false 15 | borderView.backgroundColor = UIColor.lightGray.withAlphaComponent(0.4) 16 | 17 | switch axis { 18 | case .horizontal: 19 | borderView.widthAnchor.constraint(equalToConstant: CGFloat.thinWidth).isActive = true 20 | case .vertical: 21 | borderView.heightAnchor.constraint(equalToConstant: CGFloat.thinWidth).isActive = true 22 | @unknown default: 23 | borderView.heightAnchor.constraint(equalToConstant: CGFloat.thinWidth).isActive = true 24 | } 25 | 26 | return borderView 27 | } 28 | 29 | func addAction(_ action: AlertAction) { 30 | addArrangedSubview(makeBorderView()) 31 | 32 | action.button.heightAnchor.constraint(equalToConstant: action.button.bounds.height).isActive = true 33 | addArrangedSubview(action.button) 34 | } 35 | 36 | func removeAllArrangedSubviews() { 37 | arrangedSubviews.forEach { view in 38 | removeArrangedSubview(view) 39 | view.removeFromSuperview() 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SimpleAlert/Extension/UIViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewExtension.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | import UIKit 9 | extension UIView { 10 | static func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void, completion: @escaping (Bool) -> Void) { 11 | let curve = UIView.AnimationOptions(rawValue: 7 << 16) 12 | UIView.animate(withDuration: duration, delay: 0, options: curve, animations: animations, completion: completion) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SimpleAlert/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SimpleAlert/Info.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Info.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct Info { 12 | private var userInfo: [AnyHashable: Any]? 13 | 14 | init(userInfo: [AnyHashable: Any]?) { 15 | self.userInfo = userInfo 16 | } 17 | 18 | var keyboardFrameEnd: CGRect? { 19 | return userInfoRect(UIResponder.keyboardFrameEndUserInfoKey) 20 | } 21 | 22 | var duration: TimeInterval? { 23 | return userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval 24 | } 25 | 26 | var curve: UIView.AnimationOptions? { 27 | return (userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt).map(UIView.AnimationOptions.init) 28 | } 29 | 30 | private func userInfoRect(_ infoKey: String) -> CGRect? { 31 | let frame = (userInfo?[infoKey] as? NSValue)?.cgRectValue 32 | if let rect = frame, rect.origin.x.isInfinite || rect.origin.y.isInfinite { 33 | return nil 34 | } 35 | return frame 36 | } 37 | } 38 | 39 | extension Notification { 40 | var info: Info { 41 | return Info(userInfo: userInfo) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SimpleAlert/SimpleAlert.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleAlert.h 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SimpleAlert. 12 | FOUNDATION_EXPORT double SimpleAlertVersionNumber; 13 | 14 | //! Project version string for SimpleAlert. 15 | FOUNDATION_EXPORT const unsigned char SimpleAlertVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SimpleAlert/TextField.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextField.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/24. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | import UIKit 9 | 10 | final class TextField: UITextField { 11 | var handler: ((UITextField) -> Void)? 12 | 13 | init() { 14 | super.init(frame: .zero) 15 | font = .systemFont(ofSize: 14) 16 | backgroundColor = UIColor.white 17 | layer.borderColor = UIColor.gray.cgColor 18 | layer.borderWidth = CGFloat.thinWidth 19 | } 20 | 21 | required init?(coder aDecoder: NSCoder) { 22 | fatalError("init(coder:) has not been implemented") 23 | } 24 | 25 | override func textRect(forBounds bounds: CGRect) -> CGRect { 26 | return bounds.insetBy(dx: 4, dy: 0) 27 | } 28 | 29 | override func editingRect(forBounds bounds: CGRect) -> CGRect { 30 | return bounds.insetBy(dx: 4, dy: 0) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SimpleAlert/Transition/ActionSheetControllerDismissTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheetControllerDismissTransition.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ActionSheetControllerDismissTransition: ViewControllerAnimatedTransition { 12 | override func animateTransition(_ from: UIViewController, to: UIViewController, container: UIView, completion: @escaping (Bool) -> Void) { 13 | container.addSubview(from.view) 14 | 15 | UIView.animate(withDuration: duration, animations: { 16 | from.view.transform = CGAffineTransform(translationX: 0, y: from.view.bounds.height) 17 | container.subviews.forEach { view in 18 | if view !== from.view { 19 | view.alpha = 0 20 | } 21 | } 22 | }) { _ in 23 | completion(true) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimpleAlert/Transition/ActionSheetControllerPresentTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheetControllerPresentTransition.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ActionSheetControllerPresentTransition: ViewControllerAnimatedTransition { 12 | override func animateTransition(_ from: UIViewController, to: UIViewController, container: UIView, completion: @escaping (Bool) -> Void) { 13 | let backgroundView = UIView(frame: container.bounds) 14 | backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 15 | backgroundView.alpha = 0 16 | backgroundView.backgroundColor = backgroundColor.withAlphaComponent(0.4) 17 | container.addSubview(backgroundView) 18 | 19 | to.view.frame = container.bounds 20 | container.addSubview(to.view) 21 | 22 | to.view.transform = CGAffineTransform(translationX: 0, y: to.view.bounds.height) 23 | 24 | UIView.animate(withDuration: duration, animations: { 25 | to.view.transform = .identity 26 | backgroundView.alpha = 1 27 | }) { _ in 28 | completion(true) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleAlert/Transition/AlertControllerDismissTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertControllerDismissTransition.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AlertControllerDismissTransition: ViewControllerAnimatedTransition { 12 | override func animateTransition(_ from: UIViewController, to: UIViewController, container: UIView, completion: @escaping (Bool) -> Void) { 13 | container.addSubview(from.view) 14 | 15 | UIView.animate(withDuration: duration, animations: { 16 | container.subviews.forEach { view in 17 | view.alpha = 0 18 | } 19 | }) { _ in 20 | completion(true) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SimpleAlert/Transition/AlertControllerPresentTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertControllerPresentTransition.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AlertControllerPresentTransition: ViewControllerAnimatedTransition { 12 | override func animateTransition(_ from: UIViewController, to: UIViewController, container: UIView, completion: @escaping (Bool) -> Void) { 13 | let backgroundView = UIView(frame: container.bounds) 14 | backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 15 | backgroundView.alpha = 0 16 | backgroundView.backgroundColor = backgroundColor.withAlphaComponent(0.4) 17 | container.addSubview(backgroundView) 18 | 19 | to.view.frame = container.bounds 20 | to.view.transform = from.view.transform.concatenating(CGAffineTransform(scaleX: 1.2, y: 1.2)) 21 | to.view.alpha = 0 22 | container.addSubview(to.view) 23 | 24 | UIView.animate(withDuration: duration, animations: { 25 | to.view.transform = from.view.transform 26 | container.subviews.forEach { view in 27 | view.alpha = 1 28 | } 29 | }) { _ in 30 | completion(true) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleAlert/Transition/ViewControllerAnimatedTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewControllerAnimatedTransition.swift 3 | // SimpleAlert 4 | // 5 | // Created by Kyohei Ito on 2017/11/25. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewControllerAnimatedTransition: NSObject, UIViewControllerAnimatedTransitioning { 12 | let backgroundColor: UIColor 13 | init(backgroundColor: UIColor) { 14 | self.backgroundColor = backgroundColor 15 | super.init() 16 | } 17 | 18 | var duration: TimeInterval { 19 | return 0.3 20 | } 21 | 22 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 23 | return duration 24 | } 25 | 26 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 27 | guard let fromController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from) else { 28 | return transitionContext.completeTransition(false) 29 | } 30 | 31 | guard let toController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) else { 32 | return transitionContext.completeTransition(false) 33 | } 34 | 35 | animateTransition(fromController, to: toController, container: transitionContext.containerView) { 36 | transitionContext.completeTransition($0) 37 | } 38 | } 39 | 40 | func animateTransition(_ from: UIViewController, to: UIViewController, container: UIView, completion: @escaping (Bool) -> Void) { 41 | container.addSubview(to.view) 42 | 43 | UIView.animate(withDuration: duration, animations: container.layoutIfNeeded, completion: completion) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C70C0C671A5FC018002BC071 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0C661A5FC018002BC071 /* AppDelegate.swift */; }; 11 | C70C0C691A5FC018002BC071 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0C681A5FC018002BC071 /* ViewController.swift */; }; 12 | C70C0C6C1A5FC018002BC071 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C70C0C6A1A5FC018002BC071 /* Main.storyboard */; }; 13 | C70C0C6E1A5FC018002BC071 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C70C0C6D1A5FC018002BC071 /* Images.xcassets */; }; 14 | C70C0C711A5FC019002BC071 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C70C0C6F1A5FC019002BC071 /* LaunchScreen.xib */; }; 15 | C70C0C7D1A5FC019002BC071 /* SimpleAlertExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0C7C1A5FC019002BC071 /* SimpleAlertExampleTests.swift */; }; 16 | C70C0CA31A5FC4E7002BC071 /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0CA21A5FC4E7002BC071 /* AlertController.swift */; }; 17 | C70C0CA61A5FC4ED002BC071 /* ContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70C0CA41A5FC4ED002BC071 /* ContentViewController.swift */; }; 18 | C70C0CA71A5FC4ED002BC071 /* ContentViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C70C0CA51A5FC4ED002BC071 /* ContentViewController.xib */; }; 19 | C7B9CFB31A6E467E006F15E7 /* SimpleAlert.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7D544EA1A6D781C00060C61 /* SimpleAlert.framework */; }; 20 | C7B9CFB41A6E467E006F15E7 /* SimpleAlert.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C7D544EA1A6D781C00060C61 /* SimpleAlert.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 21 | C7B9CFB81A6E4684006F15E7 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7261D111A6C1A4000AAE11D /* MapKit.framework */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | C70C0C771A5FC019002BC071 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = C70C0C591A5FC018002BC071 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = C70C0C601A5FC018002BC071; 30 | remoteInfo = SimpleAlertExample; 31 | }; 32 | C7B9CFB51A6E467E006F15E7 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */; 35 | proxyType = 1; 36 | remoteGlobalIDString = C70C0C371A5FBEC8002BC071; 37 | remoteInfo = SimpleAlert; 38 | }; 39 | C7D544E91A6D781C00060C61 /* PBXContainerItemProxy */ = { 40 | isa = PBXContainerItemProxy; 41 | containerPortal = C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */; 42 | proxyType = 2; 43 | remoteGlobalIDString = C70C0C381A5FBEC8002BC071; 44 | remoteInfo = SimpleAlert; 45 | }; 46 | C7D544EB1A6D781C00060C61 /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */; 49 | proxyType = 2; 50 | remoteGlobalIDString = C70C0C431A5FBEC8002BC071; 51 | remoteInfo = SimpleAlertTests; 52 | }; 53 | /* End PBXContainerItemProxy section */ 54 | 55 | /* Begin PBXCopyFilesBuildPhase section */ 56 | C7B9CFB71A6E467E006F15E7 /* Embed Frameworks */ = { 57 | isa = PBXCopyFilesBuildPhase; 58 | buildActionMask = 2147483647; 59 | dstPath = ""; 60 | dstSubfolderSpec = 10; 61 | files = ( 62 | C7B9CFB41A6E467E006F15E7 /* SimpleAlert.framework in Embed Frameworks */, 63 | ); 64 | name = "Embed Frameworks"; 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXCopyFilesBuildPhase section */ 68 | 69 | /* Begin PBXFileReference section */ 70 | C70C0C611A5FC018002BC071 /* SimpleAlertExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleAlertExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | C70C0C651A5FC018002BC071 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 72 | C70C0C661A5FC018002BC071 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 73 | C70C0C681A5FC018002BC071 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 74 | C70C0C6B1A5FC018002BC071 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 75 | C70C0C6D1A5FC018002BC071 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 76 | C70C0C701A5FC019002BC071 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 77 | C70C0C761A5FC019002BC071 /* SimpleAlertExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleAlertExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | C70C0C7B1A5FC019002BC071 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 79 | C70C0C7C1A5FC019002BC071 /* SimpleAlertExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleAlertExampleTests.swift; sourceTree = ""; }; 80 | C70C0CA21A5FC4E7002BC071 /* AlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = ""; }; 81 | C70C0CA41A5FC4ED002BC071 /* ContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentViewController.swift; sourceTree = ""; }; 82 | C70C0CA51A5FC4ED002BC071 /* ContentViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ContentViewController.xib; sourceTree = ""; }; 83 | C7261D111A6C1A4000AAE11D /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 84 | C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SimpleAlert.xcodeproj; path = ../SimpleAlert.xcodeproj; sourceTree = ""; }; 85 | /* End PBXFileReference section */ 86 | 87 | /* Begin PBXFrameworksBuildPhase section */ 88 | C70C0C5E1A5FC018002BC071 /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | C7B9CFB81A6E4684006F15E7 /* MapKit.framework in Frameworks */, 93 | C7B9CFB31A6E467E006F15E7 /* SimpleAlert.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | C70C0C731A5FC019002BC071 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | C70C0C581A5FC018002BC071 = { 108 | isa = PBXGroup; 109 | children = ( 110 | C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */, 111 | C70C0C631A5FC018002BC071 /* SimpleAlertExample */, 112 | C70C0C791A5FC019002BC071 /* SimpleAlertExampleTests */, 113 | C70C0C621A5FC018002BC071 /* Products */, 114 | C7261D141A6C1C5F00AAE11D /* Frameworks */, 115 | ); 116 | sourceTree = ""; 117 | }; 118 | C70C0C621A5FC018002BC071 /* Products */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | C70C0C611A5FC018002BC071 /* SimpleAlertExample.app */, 122 | C70C0C761A5FC019002BC071 /* SimpleAlertExampleTests.xctest */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | C70C0C631A5FC018002BC071 /* SimpleAlertExample */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | C70C0CA21A5FC4E7002BC071 /* AlertController.swift */, 131 | C70C0C661A5FC018002BC071 /* AppDelegate.swift */, 132 | C70C0CA41A5FC4ED002BC071 /* ContentViewController.swift */, 133 | C70C0CA51A5FC4ED002BC071 /* ContentViewController.xib */, 134 | C70C0C681A5FC018002BC071 /* ViewController.swift */, 135 | C70C0C6A1A5FC018002BC071 /* Main.storyboard */, 136 | C70C0C6D1A5FC018002BC071 /* Images.xcassets */, 137 | C70C0C6F1A5FC019002BC071 /* LaunchScreen.xib */, 138 | C70C0C641A5FC018002BC071 /* Supporting Files */, 139 | ); 140 | path = SimpleAlertExample; 141 | sourceTree = ""; 142 | }; 143 | C70C0C641A5FC018002BC071 /* Supporting Files */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | C70C0C651A5FC018002BC071 /* Info.plist */, 147 | ); 148 | name = "Supporting Files"; 149 | sourceTree = ""; 150 | }; 151 | C70C0C791A5FC019002BC071 /* SimpleAlertExampleTests */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | C70C0C7C1A5FC019002BC071 /* SimpleAlertExampleTests.swift */, 155 | C70C0C7A1A5FC019002BC071 /* Supporting Files */, 156 | ); 157 | path = SimpleAlertExampleTests; 158 | sourceTree = ""; 159 | }; 160 | C70C0C7A1A5FC019002BC071 /* Supporting Files */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | C70C0C7B1A5FC019002BC071 /* Info.plist */, 164 | ); 165 | name = "Supporting Files"; 166 | sourceTree = ""; 167 | }; 168 | C7261D141A6C1C5F00AAE11D /* Frameworks */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | C7261D111A6C1A4000AAE11D /* MapKit.framework */, 172 | ); 173 | name = Frameworks; 174 | sourceTree = ""; 175 | }; 176 | C7D544E51A6D781B00060C61 /* Products */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | C7D544EA1A6D781C00060C61 /* SimpleAlert.framework */, 180 | C7D544EC1A6D781C00060C61 /* SimpleAlertTests.xctest */, 181 | ); 182 | name = Products; 183 | sourceTree = ""; 184 | }; 185 | /* End PBXGroup section */ 186 | 187 | /* Begin PBXNativeTarget section */ 188 | C70C0C601A5FC018002BC071 /* SimpleAlertExample */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = C70C0C801A5FC019002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertExample" */; 191 | buildPhases = ( 192 | C70C0C5D1A5FC018002BC071 /* Sources */, 193 | C70C0C5E1A5FC018002BC071 /* Frameworks */, 194 | C70C0C5F1A5FC018002BC071 /* Resources */, 195 | C7B9CFB71A6E467E006F15E7 /* Embed Frameworks */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | C7B9CFB61A6E467E006F15E7 /* PBXTargetDependency */, 201 | ); 202 | name = SimpleAlertExample; 203 | productName = SimpleAlertExample; 204 | productReference = C70C0C611A5FC018002BC071 /* SimpleAlertExample.app */; 205 | productType = "com.apple.product-type.application"; 206 | }; 207 | C70C0C751A5FC019002BC071 /* SimpleAlertExampleTests */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = C70C0C831A5FC019002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertExampleTests" */; 210 | buildPhases = ( 211 | C70C0C721A5FC019002BC071 /* Sources */, 212 | C70C0C731A5FC019002BC071 /* Frameworks */, 213 | C70C0C741A5FC019002BC071 /* Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | C70C0C781A5FC019002BC071 /* PBXTargetDependency */, 219 | ); 220 | name = SimpleAlertExampleTests; 221 | productName = SimpleAlertExampleTests; 222 | productReference = C70C0C761A5FC019002BC071 /* SimpleAlertExampleTests.xctest */; 223 | productType = "com.apple.product-type.bundle.unit-test"; 224 | }; 225 | /* End PBXNativeTarget section */ 226 | 227 | /* Begin PBXProject section */ 228 | C70C0C591A5FC018002BC071 /* Project object */ = { 229 | isa = PBXProject; 230 | attributes = { 231 | LastSwiftUpdateCheck = 0700; 232 | LastUpgradeCheck = 1020; 233 | ORGANIZATIONNAME = kyohei_ito; 234 | TargetAttributes = { 235 | C70C0C601A5FC018002BC071 = { 236 | CreatedOnToolsVersion = 6.2; 237 | LastSwiftMigration = 1020; 238 | }; 239 | C70C0C751A5FC019002BC071 = { 240 | CreatedOnToolsVersion = 6.2; 241 | LastSwiftMigration = 1020; 242 | TestTargetID = C70C0C601A5FC018002BC071; 243 | }; 244 | }; 245 | }; 246 | buildConfigurationList = C70C0C5C1A5FC018002BC071 /* Build configuration list for PBXProject "SimpleAlertExample" */; 247 | compatibilityVersion = "Xcode 3.2"; 248 | developmentRegion = en; 249 | hasScannedForEncodings = 0; 250 | knownRegions = ( 251 | en, 252 | Base, 253 | ); 254 | mainGroup = C70C0C581A5FC018002BC071; 255 | productRefGroup = C70C0C621A5FC018002BC071 /* Products */; 256 | projectDirPath = ""; 257 | projectReferences = ( 258 | { 259 | ProductGroup = C7D544E51A6D781B00060C61 /* Products */; 260 | ProjectRef = C7D544E41A6D781B00060C61 /* SimpleAlert.xcodeproj */; 261 | }, 262 | ); 263 | projectRoot = ""; 264 | targets = ( 265 | C70C0C601A5FC018002BC071 /* SimpleAlertExample */, 266 | C70C0C751A5FC019002BC071 /* SimpleAlertExampleTests */, 267 | ); 268 | }; 269 | /* End PBXProject section */ 270 | 271 | /* Begin PBXReferenceProxy section */ 272 | C7D544EA1A6D781C00060C61 /* SimpleAlert.framework */ = { 273 | isa = PBXReferenceProxy; 274 | fileType = wrapper.framework; 275 | path = SimpleAlert.framework; 276 | remoteRef = C7D544E91A6D781C00060C61 /* PBXContainerItemProxy */; 277 | sourceTree = BUILT_PRODUCTS_DIR; 278 | }; 279 | C7D544EC1A6D781C00060C61 /* SimpleAlertTests.xctest */ = { 280 | isa = PBXReferenceProxy; 281 | fileType = wrapper.cfbundle; 282 | path = SimpleAlertTests.xctest; 283 | remoteRef = C7D544EB1A6D781C00060C61 /* PBXContainerItemProxy */; 284 | sourceTree = BUILT_PRODUCTS_DIR; 285 | }; 286 | /* End PBXReferenceProxy section */ 287 | 288 | /* Begin PBXResourcesBuildPhase section */ 289 | C70C0C5F1A5FC018002BC071 /* Resources */ = { 290 | isa = PBXResourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | C70C0CA71A5FC4ED002BC071 /* ContentViewController.xib in Resources */, 294 | C70C0C6C1A5FC018002BC071 /* Main.storyboard in Resources */, 295 | C70C0C711A5FC019002BC071 /* LaunchScreen.xib in Resources */, 296 | C70C0C6E1A5FC018002BC071 /* Images.xcassets in Resources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | C70C0C741A5FC019002BC071 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | /* End PBXResourcesBuildPhase section */ 308 | 309 | /* Begin PBXSourcesBuildPhase section */ 310 | C70C0C5D1A5FC018002BC071 /* Sources */ = { 311 | isa = PBXSourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | C70C0CA61A5FC4ED002BC071 /* ContentViewController.swift in Sources */, 315 | C70C0C691A5FC018002BC071 /* ViewController.swift in Sources */, 316 | C70C0CA31A5FC4E7002BC071 /* AlertController.swift in Sources */, 317 | C70C0C671A5FC018002BC071 /* AppDelegate.swift in Sources */, 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | C70C0C721A5FC019002BC071 /* Sources */ = { 322 | isa = PBXSourcesBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | C70C0C7D1A5FC019002BC071 /* SimpleAlertExampleTests.swift in Sources */, 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | /* End PBXSourcesBuildPhase section */ 330 | 331 | /* Begin PBXTargetDependency section */ 332 | C70C0C781A5FC019002BC071 /* PBXTargetDependency */ = { 333 | isa = PBXTargetDependency; 334 | target = C70C0C601A5FC018002BC071 /* SimpleAlertExample */; 335 | targetProxy = C70C0C771A5FC019002BC071 /* PBXContainerItemProxy */; 336 | }; 337 | C7B9CFB61A6E467E006F15E7 /* PBXTargetDependency */ = { 338 | isa = PBXTargetDependency; 339 | name = SimpleAlert; 340 | targetProxy = C7B9CFB51A6E467E006F15E7 /* PBXContainerItemProxy */; 341 | }; 342 | /* End PBXTargetDependency section */ 343 | 344 | /* Begin PBXVariantGroup section */ 345 | C70C0C6A1A5FC018002BC071 /* Main.storyboard */ = { 346 | isa = PBXVariantGroup; 347 | children = ( 348 | C70C0C6B1A5FC018002BC071 /* Base */, 349 | ); 350 | name = Main.storyboard; 351 | sourceTree = ""; 352 | }; 353 | C70C0C6F1A5FC019002BC071 /* LaunchScreen.xib */ = { 354 | isa = PBXVariantGroup; 355 | children = ( 356 | C70C0C701A5FC019002BC071 /* Base */, 357 | ); 358 | name = LaunchScreen.xib; 359 | sourceTree = ""; 360 | }; 361 | /* End PBXVariantGroup section */ 362 | 363 | /* Begin XCBuildConfiguration section */ 364 | C70C0C7E1A5FC019002BC071 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 374 | CLANG_WARN_BOOL_CONVERSION = YES; 375 | CLANG_WARN_COMMA = YES; 376 | CLANG_WARN_CONSTANT_CONVERSION = YES; 377 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 378 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 379 | CLANG_WARN_EMPTY_BODY = YES; 380 | CLANG_WARN_ENUM_CONVERSION = YES; 381 | CLANG_WARN_INFINITE_RECURSION = YES; 382 | CLANG_WARN_INT_CONVERSION = YES; 383 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 385 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 386 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 387 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 388 | CLANG_WARN_STRICT_PROTOTYPES = YES; 389 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 390 | CLANG_WARN_UNREACHABLE_CODE = YES; 391 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 392 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 393 | COPY_PHASE_STRIP = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | ENABLE_TESTABILITY = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu99; 397 | GCC_DYNAMIC_NO_PIC = NO; 398 | GCC_NO_COMMON_BLOCKS = YES; 399 | GCC_OPTIMIZATION_LEVEL = 0; 400 | GCC_PREPROCESSOR_DEFINITIONS = ( 401 | "DEBUG=1", 402 | "$(inherited)", 403 | ); 404 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 405 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 406 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 407 | GCC_WARN_UNDECLARED_SELECTOR = YES; 408 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 409 | GCC_WARN_UNUSED_FUNCTION = YES; 410 | GCC_WARN_UNUSED_VARIABLE = YES; 411 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 412 | MTL_ENABLE_DEBUG_INFO = YES; 413 | ONLY_ACTIVE_ARCH = YES; 414 | SDKROOT = iphoneos; 415 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 416 | }; 417 | name = Debug; 418 | }; 419 | C70C0C7F1A5FC019002BC071 /* Release */ = { 420 | isa = XCBuildConfiguration; 421 | buildSettings = { 422 | ALWAYS_SEARCH_USER_PATHS = NO; 423 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 424 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 425 | CLANG_CXX_LIBRARY = "libc++"; 426 | CLANG_ENABLE_MODULES = YES; 427 | CLANG_ENABLE_OBJC_ARC = YES; 428 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 429 | CLANG_WARN_BOOL_CONVERSION = YES; 430 | CLANG_WARN_COMMA = YES; 431 | CLANG_WARN_CONSTANT_CONVERSION = YES; 432 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 433 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 434 | CLANG_WARN_EMPTY_BODY = YES; 435 | CLANG_WARN_ENUM_CONVERSION = YES; 436 | CLANG_WARN_INFINITE_RECURSION = YES; 437 | CLANG_WARN_INT_CONVERSION = YES; 438 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 439 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 440 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 441 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 442 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 443 | CLANG_WARN_STRICT_PROTOTYPES = YES; 444 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 445 | CLANG_WARN_UNREACHABLE_CODE = YES; 446 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 447 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 448 | COPY_PHASE_STRIP = NO; 449 | ENABLE_NS_ASSERTIONS = NO; 450 | ENABLE_STRICT_OBJC_MSGSEND = YES; 451 | GCC_C_LANGUAGE_STANDARD = gnu99; 452 | GCC_NO_COMMON_BLOCKS = YES; 453 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 454 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 455 | GCC_WARN_UNDECLARED_SELECTOR = YES; 456 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 457 | GCC_WARN_UNUSED_FUNCTION = YES; 458 | GCC_WARN_UNUSED_VARIABLE = YES; 459 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 460 | MTL_ENABLE_DEBUG_INFO = NO; 461 | SDKROOT = iphoneos; 462 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 463 | VALIDATE_PRODUCT = YES; 464 | }; 465 | name = Release; 466 | }; 467 | C70C0C811A5FC019002BC071 /* Debug */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 471 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 472 | INFOPLIST_FILE = SimpleAlertExample/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | SWIFT_VERSION = 5.0; 477 | }; 478 | name = Debug; 479 | }; 480 | C70C0C821A5FC019002BC071 /* Release */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 484 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 485 | INFOPLIST_FILE = SimpleAlertExample/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | SWIFT_VERSION = 5.0; 490 | }; 491 | name = Release; 492 | }; 493 | C70C0C841A5FC019002BC071 /* Debug */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | BUNDLE_LOADER = "$(TEST_HOST)"; 497 | GCC_PREPROCESSOR_DEFINITIONS = ( 498 | "DEBUG=1", 499 | "$(inherited)", 500 | ); 501 | INFOPLIST_FILE = SimpleAlertExampleTests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 503 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 504 | PRODUCT_NAME = "$(TARGET_NAME)"; 505 | SWIFT_VERSION = 5.0; 506 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleAlertExample.app/SimpleAlertExample"; 507 | }; 508 | name = Debug; 509 | }; 510 | C70C0C851A5FC019002BC071 /* Release */ = { 511 | isa = XCBuildConfiguration; 512 | buildSettings = { 513 | BUNDLE_LOADER = "$(TEST_HOST)"; 514 | INFOPLIST_FILE = SimpleAlertExampleTests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyoheiito.$(PRODUCT_NAME:rfc1034identifier)"; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | SWIFT_VERSION = 5.0; 519 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleAlertExample.app/SimpleAlertExample"; 520 | }; 521 | name = Release; 522 | }; 523 | /* End XCBuildConfiguration section */ 524 | 525 | /* Begin XCConfigurationList section */ 526 | C70C0C5C1A5FC018002BC071 /* Build configuration list for PBXProject "SimpleAlertExample" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | C70C0C7E1A5FC019002BC071 /* Debug */, 530 | C70C0C7F1A5FC019002BC071 /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | defaultConfigurationName = Release; 534 | }; 535 | C70C0C801A5FC019002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertExample" */ = { 536 | isa = XCConfigurationList; 537 | buildConfigurations = ( 538 | C70C0C811A5FC019002BC071 /* Debug */, 539 | C70C0C821A5FC019002BC071 /* Release */, 540 | ); 541 | defaultConfigurationIsVisible = 0; 542 | defaultConfigurationName = Release; 543 | }; 544 | C70C0C831A5FC019002BC071 /* Build configuration list for PBXNativeTarget "SimpleAlertExampleTests" */ = { 545 | isa = XCConfigurationList; 546 | buildConfigurations = ( 547 | C70C0C841A5FC019002BC071 /* Debug */, 548 | C70C0C851A5FC019002BC071 /* Release */, 549 | ); 550 | defaultConfigurationIsVisible = 0; 551 | defaultConfigurationName = Release; 552 | }; 553 | /* End XCConfigurationList section */ 554 | }; 555 | rootObject = C70C0C591A5FC018002BC071 /* Project object */; 556 | } 557 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/AlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertController.swift 3 | // SheetAlertExample 4 | // 5 | // Created by Kyohei Ito on 2015/01/05. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SimpleAlert 11 | 12 | class CustomAlertController: AlertController { 13 | override func addTextField(configurationHandler: ((UITextField) -> Void)? = nil) { 14 | super.addTextField { textField in 15 | textField.frame.size.height = 33 16 | textField.backgroundColor = nil 17 | textField.layer.borderColor = nil 18 | textField.layer.borderWidth = 0 19 | 20 | configurationHandler?(textField) 21 | } 22 | } 23 | 24 | override func configureActionButton(_ button: UIButton, at style :AlertAction.Style) { 25 | super.configureActionButton(button, at: style) 26 | 27 | switch style { 28 | case .ok: 29 | button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20) 30 | button.setTitleColor(UIColor.gray, for: .normal) 31 | case .cancel: 32 | button.backgroundColor = UIColor.darkGray 33 | button.setTitleColor(UIColor.white, for: .normal) 34 | case .default: 35 | button.setTitleColor(UIColor.lightGray, for: .normal) 36 | default: 37 | break 38 | } 39 | } 40 | 41 | override func configureContentView(_ contentView: AlertContentView) { 42 | super.configureContentView(contentView) 43 | 44 | contentView.titleLabel.textColor = UIColor.lightGray 45 | contentView.titleLabel.font = UIFont.boldSystemFont(ofSize: 30) 46 | contentView.messageLabel.textColor = UIColor.lightGray 47 | contentView.messageLabel.font = UIFont.boldSystemFont(ofSize: 16) 48 | contentView.textBackgroundView.layer.cornerRadius = 10.0 49 | contentView.textBackgroundView.clipsToBounds = true 50 | contentView.textBackgroundView.backgroundColor = .lightGray 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SimpleAlertExample 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. 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: [UIApplication.LaunchOptionsKey: 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 throttle down OpenGL ES frame rates. 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 inactive 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 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/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 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 38 | 47 | 56 | 65 | 74 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/ContentViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentViewController.swift 3 | // SheetAlertExample 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ContentViewController: UIViewController { 12 | 13 | init() { 14 | super.init(nibName: "ContentViewController", bundle: nil) 15 | } 16 | 17 | required init?(coder aDecoder: NSCoder) { 18 | super.init(coder: aDecoder) 19 | } 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | 24 | // Do any additional setup after loading the view. 25 | } 26 | 27 | override func didReceiveMemoryWarning() { 28 | super.didReceiveMemoryWarning() 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | 33 | /* 34 | // MARK: - Navigation 35 | 36 | // In a storyboard-based application, you will often want to do a little preparation before navigation 37 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 38 | // Get the new view controller using segue.destinationViewController. 39 | // Pass the selected object to the new view controller. 40 | } 41 | */ 42 | 43 | } 44 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/ContentViewController.xib: -------------------------------------------------------------------------------- 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 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/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 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SimpleAlertExample 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SimpleAlert 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | @IBAction func defaultAlertButtonWasTapped(_ sender: AnyObject) { 25 | let alert = AlertController(title: "title", message: "message", style: .alert) 26 | alert.addTextField() 27 | alert.addTextField() 28 | showAlert(alert) 29 | } 30 | 31 | @IBAction func customAlertButtonWasTapped(_ sender: AnyObject) { 32 | let alert = CustomAlertController(title: "title", message: "message", style: .alert) 33 | alert.addTextField() 34 | alert.addTextField() 35 | showAlert(alert) 36 | } 37 | 38 | @IBAction func defaultActionSheetButtonWasTapped(_ sender: AnyObject) { 39 | let alert = AlertController(title: "title", message: "message", style: .actionSheet) 40 | showAlert(alert) 41 | } 42 | 43 | @IBAction func customActionSheetButtonWasTapped(_ sender: AnyObject) { 44 | let alert = CustomAlertController(title: "title", message: "message", style: .actionSheet) 45 | showAlert(alert) 46 | } 47 | 48 | @IBAction func customContentButtonWasTapped(_ sender: AnyObject) { 49 | let viewController = ContentViewController() 50 | let alert = AlertController(title: "Map", view: viewController.view, style: .actionSheet) 51 | showAlert(alert) 52 | } 53 | 54 | @IBAction func roundedButtonWasTapped(_ sender: AnyObject) { 55 | let alert = AlertController(view: UIView(), style: .alert) 56 | alert.contentWidth = 144 57 | alert.contentCornerRadius = 72 58 | alert.contentColor = .white 59 | let action = AlertAction(title: "?", style: .cancel) { action in 60 | } 61 | 62 | alert.addAction(action) 63 | action.button.frame.size.height = 144 64 | action.button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 96) 65 | action.button.setTitleColor(UIColor.red, for: .normal) 66 | 67 | self.present(alert, animated: true, completion: nil) 68 | } 69 | 70 | func showAlert(_ alert: AlertController) { 71 | alert.addAction(AlertAction(title: "Cancel", style: .cancel) { action in 72 | }) 73 | 74 | alert.addAction(AlertAction(title: "Default", style: .default) { action in 75 | }) 76 | 77 | alert.addAction(AlertAction(title: "Destructive", style: .destructive) { action in 78 | }) 79 | 80 | alert.addAction(AlertAction(title: "OK", style: .ok) { action in 81 | }) 82 | 83 | self.present(alert, animated: true, completion: nil) 84 | } 85 | 86 | @IBAction func normalAlertButtonWasTapped(_ sender: AnyObject) { 87 | let alert = UIAlertController(title: "title", message: "message", preferredStyle: .alert) 88 | alert.addTextField() { textField in 89 | } 90 | 91 | alert.addTextField() { textField in 92 | } 93 | 94 | alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { action in 95 | }) 96 | 97 | alert.addAction(UIAlertAction(title: "Default", style: .default) { action in 98 | }) 99 | 100 | alert.addAction(UIAlertAction(title: "Destructive", style: .destructive) { action in 101 | }) 102 | 103 | alert.addAction(UIAlertAction(title: "OK", style: .default) { action in 104 | }) 105 | 106 | self.present(alert, animated: true, completion: nil) 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExampleTests/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 | -------------------------------------------------------------------------------- /SimpleAlertExample/SimpleAlertExampleTests/SimpleAlertExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleAlertExampleTests.swift 3 | // SimpleAlertExampleTests 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SimpleAlertExampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /SimpleAlertTests/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 | -------------------------------------------------------------------------------- /SimpleAlertTests/SimpleAlertTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleAlertTests.swift 3 | // SimpleAlertTests 4 | // 5 | // Created by Kyohei Ito on 2015/01/09. 6 | // Copyright (c) 2015年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SimpleAlertTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Sources/SimpleAlert/SimpleAlert.swift: -------------------------------------------------------------------------------- 1 | public struct SimpleAlert { 2 | public private(set) var text = "Hello, World!" 3 | 4 | public init() { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Tests/SimpleAlertTests/SimpleAlertTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import SimpleAlert 3 | 4 | final class SimpleAlertTests: XCTestCase { 5 | func testExample() throws { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | XCTAssert(true, "Hello, World!") 10 | } 11 | } 12 | --------------------------------------------------------------------------------