├── .swift-version ├── .swiftlint.yml ├── DEMO ├── .swiftlint.yml ├── KRAlertControllerDemo.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj └── KRAlertControllerDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── UIViewExtension.swift │ ├── Info.plist │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ └── ViewController.swift ├── KRAlertController.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── KRAlertController.xcscheme └── project.pbxproj ├── .travis.yml ├── KRAlertController ├── KRAlertController.h ├── Info.plist └── Classes │ ├── KRAlertContentView │ ├── KRAlertButton.swift │ ├── KRAlertButtonTable.swift │ ├── KRAlertTextFieldView.swift │ └── KRAlertContentView.swift │ ├── KRAlertAction.swift │ ├── SupportFiles │ ├── KRAlertControllerExtensions.swift │ ├── KRAlertControllerEnumerates.swift │ └── KRAlertIconPath.swift │ ├── KRAlertBaseViewController.swift │ └── KRAlertController.swift ├── KRAlertController.podspec ├── .gitignore ├── KRAlertControllerTests ├── Info.plist └── KRAlertControllerTests.swift ├── LICENSE ├── README_Ja.md └── README.md /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - line_length 3 | - file_length 4 | included: 5 | - KRAlertController 6 | excluded: 7 | - Pods 8 | type_body_length: 9 | - 400 # warning 10 | - 500 # error 11 | -------------------------------------------------------------------------------- /DEMO/.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - line_length 3 | - file_length 4 | included: 5 | - KRAlertControllerDEMO 6 | excluded: 7 | - Pods 8 | type_body_length: 9 | - 400 # warning 10 | - 500 # error 11 | -------------------------------------------------------------------------------- /KRAlertController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10 3 | xcode_sdk: iphonesimulator12 4 | install: 5 | - gem install xcpretty 6 | script: 7 | - set -o pipefail 8 | - travis_retry xcodebuild -project KRAlertController.xcodeproj -scheme KRAlertController -destination "platform=iOS Simulator,name=iPhone 8" build-for-testing test | xcpretty 9 | notifications: 10 | email: false 11 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KRAlertControllerDemo 4 | // 5 | // Created by Ryunosuke Kirikihira on 2016/06/18. 6 | // Copyright © 2016年 Krimpedance. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | return true 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KRAlertController/KRAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertController.h 3 | // KRAlertController 4 | // 5 | // Created by Ryunosuke Kirikihira on 2016/06/18. 6 | // Copyright © 2016年 Krimpedance. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KRAlertController. 12 | FOUNDATION_EXPORT double KRAlertControllerVersionNumber; 13 | 14 | //! Project version string for KRAlertController. 15 | FOUNDATION_EXPORT const unsigned char KRAlertControllerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /KRAlertController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "KRAlertController" 3 | s.version = "3.1.0" 4 | s.summary = "A beautiful alert controller for your iOS." 5 | s.description = "KRAlertController is a beautiful and easy-to-use alert controller on iOS." 6 | s.homepage = "https://github.com/krimpedance/KRAlertController" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | 9 | s.author = { "krimpedance" => "info@krimpedance.com" } 10 | s.requires_arc = true 11 | s.platform = :ios, '10.0' 12 | s.ios.deployment_target = '10.0' 13 | 14 | s.source = { :git => "https://github.com/krimpedance/KRAlertController.git", :tag => s.version.to_s } 15 | s.source_files = "KRAlertController/**/*.swift" 16 | end 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | Podfile.lock 35 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /KRAlertControllerTests/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 | -------------------------------------------------------------------------------- /KRAlertController/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 | 3.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/UIViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewExtension.swift 3 | // KRAlertControllerDemo 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | extension UIView { 11 | @IBInspectable var cornerRadius: CGFloat { 12 | get { 13 | return layer.cornerRadius 14 | } 15 | set { 16 | layer.cornerRadius = newValue 17 | layer.masksToBounds = newValue > 0 18 | } 19 | } 20 | 21 | @IBInspectable var borderWidth: CGFloat { 22 | get { 23 | return layer.borderWidth 24 | } 25 | set { 26 | layer.borderWidth = newValue 27 | } 28 | } 29 | 30 | @IBInspectable var borderColor: UIColor { 31 | get { 32 | return (layer.borderColor != nil) ? UIColor(cgColor: layer.borderColor!) : UIColor.white 33 | } 34 | set { 35 | layer.borderColor = newValue.cgColor 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 krimpedance 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /KRAlertControllerTests/KRAlertControllerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertControllerTests.swift 3 | // KRAlertControllerTests 4 | // 5 | // Created by Ryunosuke Kirikihira on 2016/06/18. 6 | // Copyright © 2016年 Krimpedance. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import KRAlertController 11 | 12 | class KRAlertControllerTests: 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 | // Use XCTAssert and related functions to verify your tests produce the correct results. 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 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertContentView/KRAlertButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertButton.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * KRAlertButton 12 | */ 13 | class KRAlertButton: UIButton { 14 | var alertAction: KRAlertAction 15 | var type: KRAlertControllerType 16 | 17 | init(frame: CGRect, action: KRAlertAction, type: KRAlertControllerType) { 18 | self.alertAction = action 19 | self.type = type 20 | super.init(frame: frame) 21 | setup() 22 | } 23 | 24 | required init?(coder aDecoder: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | } 28 | 29 | /** 30 | * Actions -------------------- 31 | */ 32 | extension KRAlertButton { 33 | func setup() { 34 | layer.cornerRadius = 5.0 35 | setTitle(alertAction.title, for: .normal) 36 | setTitleColor(type.textColor, for: .normal) 37 | setTitleColor(type.iconColor, for: .highlighted) 38 | backgroundColor = type.buttonBackgroundColor 39 | 40 | let weight: UIFont.Weight = alertAction.isPreferred ? .bold : .regular 41 | titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: weight) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/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 | 3.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 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 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertContentView/KRAlertButtonTable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertButtonTable.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * KRAlertButtonTable is used at more than 5 actions. 12 | */ 13 | class KRAlertButtonTable: UITableView { 14 | var buttons = [KRAlertButton]() 15 | 16 | convenience init(frame: CGRect, buttons: [KRAlertButton]) { 17 | self.init(frame: frame) 18 | self.buttons = buttons 19 | setup() 20 | } 21 | } 22 | 23 | /** 24 | * Actions -------------------- 25 | */ 26 | extension KRAlertButtonTable { 27 | func setup() { 28 | backgroundColor = .clear 29 | separatorStyle = .none 30 | dataSource = self 31 | } 32 | } 33 | 34 | /** 35 | * UITableView data source -------------------- 36 | */ 37 | extension KRAlertButtonTable: UITableViewDataSource { 38 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 39 | return buttons.count 40 | } 41 | 42 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 43 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell") ?? UITableViewCell() 44 | cell.backgroundColor = .clear 45 | cell.selectionStyle = .none 46 | cell.contentView.subviews.forEach { 47 | $0.removeFromSuperview() 48 | } 49 | cell.addSubview(buttons[(indexPath as NSIndexPath).row]) 50 | return cell 51 | } 52 | } 53 | 54 | /** 55 | * UITableView data source -------------------- 56 | */ 57 | extension KRAlertButtonTable: UITableViewDelegate { 58 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 59 | return 35 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertContentView/KRAlertTextFieldView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertTextFieldView.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * KRAlertTextFieldView 12 | */ 13 | class KRAlertTextFieldView: UIView { 14 | let textFieldHeight: CGFloat = 30 15 | let borderViewHeight: CGFloat = 1 16 | } 17 | 18 | /** 19 | * Actions ------------- 20 | */ 21 | extension KRAlertTextFieldView { 22 | func configureLayout(_ frame: CGRect, textFields: [UITextField], controllerType type: KRAlertControllerType) { 23 | self.frame = frame 24 | backgroundColor = .clear 25 | layer.borderWidth = 1 26 | layer.borderColor = type.buttonBackgroundColor.cgColor 27 | 28 | textFields.enumerated().forEach { index, textField in 29 | let frame = CGRect( 30 | origin: CGPoint(x: 0, y: CGFloat(index)*(textFieldHeight+borderViewHeight)), 31 | size: CGSize(width: frame.width, height: textFieldHeight) 32 | ) 33 | textField.configureLayout(frame: frame, type: type) 34 | textField.delegate = textField.delegate ?? self 35 | addSubview(textField) 36 | 37 | if textFields.count == index+1 { return } 38 | let point = CGPoint(x: 0, y: frame.origin.y+frame.height) 39 | let size = CGSize(width: bounds.width, height: 1) 40 | let borderView = UIView(frame: CGRect(origin: point, size: size)) 41 | borderView.backgroundColor = type.buttonBackgroundColor 42 | addSubview(borderView) 43 | } 44 | } 45 | } 46 | 47 | /** 48 | * UITextField delegate -------------------- 49 | */ 50 | extension KRAlertTextFieldView: UITextFieldDelegate { 51 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 52 | textField.endEditing(true) 53 | return true 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertAction.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertAction.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * Action handler when user tapped some buttons. 12 | * 13 | * - parameter KRAlertAction: Tapped button's action 14 | * 15 | * - returns: Void 16 | */ 17 | public typealias KRAlertActionHandler = (_ action: KRAlertAction, _ textFields: [UITextField]) -> Void 18 | 19 | /** 20 | * A KRAlertAction object represents an action that can be taken when tapping a button in an alert. 21 | * You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. 22 | * After creating an alert action object, add it to a KRAlertController object before displaying the corresponding alert to the user. 23 | */ 24 | public struct KRAlertAction { 25 | let actionId: String = UUID().uuidString 26 | let handler: KRAlertActionHandler? 27 | 28 | /// The text to use for the button title. 29 | public let title: String? 30 | /// Additional styling information to apply to the button. 31 | public let style: KRAlertActionStyle 32 | let isPreferred: Bool 33 | public var enabled: Bool = true 34 | 35 | /** 36 | Create and return an action with the specified title and behavior. 37 | 38 | - parameter title: The text to use for the button title. 39 | - parameter style: Additional styling information to apply to the button. 40 | - parameter isPreferred: When true, Action title become preferred style. 41 | - parameter handler: A block to execute when the user selects the action. 42 | */ 43 | init(title: String?, style: KRAlertActionStyle, isPreferred: Bool, handler: KRAlertActionHandler?) { 44 | self.title = title 45 | self.style = style 46 | self.handler = handler 47 | self.isPreferred = isPreferred 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /KRAlertController/Classes/SupportFiles/KRAlertControllerExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+topViewController.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * UILabel extension for KRAlertController 12 | */ 13 | extension UILabel { 14 | func configureLayout(frame: CGRect, text: String?, controllerType: KRAlertControllerType, labelStyle: KRAlertLabelStyle) { 15 | numberOfLines = 0 16 | lineBreakMode = .byWordWrapping 17 | textAlignment = .center 18 | backgroundColor = .clear 19 | 20 | switch labelStyle { 21 | case .title: 22 | textColor = controllerType.textColor 23 | font = UIFont.systemFont(ofSize: 20, weight: .bold) 24 | case .message: 25 | font = UIFont.systemFont(ofSize: 15) 26 | } 27 | 28 | self.frame = frame 29 | self.text = text 30 | sizeToFit() 31 | self.frame = CGRect(origin: frame.origin, size: CGSize(width: frame.width, height: self.frame.height)) 32 | } 33 | } 34 | 35 | /** 36 | * UITextField extension for KRAlertController 37 | */ 38 | extension UITextField { 39 | func configureLayout(frame: CGRect, type: KRAlertControllerType) { 40 | self.frame = frame 41 | layer.borderColor = UIColor.clear.cgColor 42 | layer.borderWidth = 0 43 | font = UIFont.systemFont(ofSize: 15) 44 | textColor = type.textColor 45 | attributedPlaceholder = NSAttributedString( 46 | string: placeholder ?? "", 47 | attributes: [.foregroundColor: type.buttonBackgroundColor] 48 | ) 49 | leftViewMode = .always 50 | leftView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: 5)) 51 | } 52 | } 53 | 54 | /** 55 | * UIApplication extension for get visible view controller 56 | */ 57 | extension UIApplication { 58 | func topViewController(_ base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? { 59 | if let nav = base as? UINavigationController { 60 | return topViewController(nav.visibleViewController) 61 | } 62 | if let tab = base as? UITabBarController { 63 | guard let selected = tab.selectedViewController else { return base } 64 | return topViewController(selected) 65 | } 66 | if let presented = base?.presentedViewController { 67 | return topViewController(presented) 68 | } 69 | return base 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertBaseViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertBaseViewController.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * A KRAlertBaseViewController object displays an alert message to the user. 12 | */ 13 | class KRAlertBaseViewController: UIViewController { 14 | var style = KRAlertControllerStyle.alert 15 | var contentView: KRAlertContentView 16 | var statusBarHidden = false 17 | 18 | init(title: String?, message: String?, actions: [KRAlertAction], textFields: [UITextField], style: KRAlertControllerStyle, type: KRAlertControllerType) { 19 | self.style = style 20 | contentView = KRAlertContentView(title: title, message: message, actions: actions, textFields: textFields, style: style, type: type) 21 | super.init(nibName: nil, bundle: nil) 22 | configureLayout() 23 | } 24 | 25 | required init?(coder aDecoder: NSCoder) { 26 | fatalError("init(coder:) has not been implemented") 27 | } 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | } 32 | 33 | override var prefersStatusBarHidden: Bool { 34 | // Prefers status bar hidden value is same visible view controller. 35 | return statusBarHidden 36 | } 37 | } 38 | 39 | /** 40 | * Actions ------------------- 41 | */ 42 | extension KRAlertBaseViewController { 43 | func configureLayout() { 44 | modalPresentationStyle = .overCurrentContext 45 | view.backgroundColor = UIColor(white: 0, alpha: 0.4) 46 | view.alpha = 0.0 47 | configureContentView() 48 | } 49 | 50 | func configureContentView() { 51 | contentView.delegate = self 52 | var center = view.center 53 | center.y -= 50 54 | contentView.center = center 55 | 56 | if style == .actionSheet { 57 | var frame = contentView.frame 58 | frame.origin.y = view.bounds.height 59 | contentView.frame = frame 60 | } 61 | 62 | view.addSubview(contentView) 63 | } 64 | 65 | func showContent() { 66 | switch style { 67 | case .alert: 68 | view.alpha = 1.0 69 | 70 | case .actionSheet: 71 | view.alpha = 1.0 72 | var frame = contentView.frame 73 | frame.origin.y = view.bounds.height - contentView.bounds.height - 20 74 | contentView.frame = frame 75 | } 76 | } 77 | 78 | func hideContent() { 79 | switch style { 80 | case .alert: 81 | view.alpha = 0.0 82 | 83 | case .actionSheet: 84 | view.alpha = 0.0 85 | var frame = contentView.frame 86 | frame.origin.y = view.bounds.height 87 | contentView.frame = frame 88 | } 89 | } 90 | } 91 | 92 | /** 93 | * KRAlertViewDelegate ------------ 94 | */ 95 | extension KRAlertBaseViewController: KRAlertViewDelegate { 96 | func didSelectActionButton(action: KRAlertAction) { 97 | UIView.animate(withDuration: 0.2, animations: { 98 | self.hideContent() 99 | }, completion: { _ in 100 | self.dismiss(animated: false) { 101 | action.handler?(action, self.contentView.textFields) 102 | } 103 | }) 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /README_Ja.md: -------------------------------------------------------------------------------- 1 | [English](./README.md) 2 | 3 | # KRAlertController 4 | 5 | [![Version](https://img.shields.io/cocoapods/v/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 6 | [![License](https://img.shields.io/cocoapods/l/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 7 | [![Platform](https://img.shields.io/cocoapods/p/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 8 | [![Download](https://img.shields.io/cocoapods/dt/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 9 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | [![CI Status](http://img.shields.io/travis/krimpedance/KRAlertController.svg?style=flat)](https://travis-ci.org/krimpedance/KRAlertController) 11 | 12 | `KRAlertController`はピュアSwiftの綺麗で使いやすいアラートコントローラーです. 13 | 14 | 15 | 16 | ## 必要環境 17 | - iOS 10.0+ 18 | - Xcode 10.0+ 19 | - Swift 4.2+ 20 | 21 | ## デモ 22 | `DEMO/`以下にあるサンプルプロジェクトから確認してください. 23 | 24 | または, [appetize.io](https://appetize.io/app/jc2066a1jncndy2uet7wkp0ykg)にてシュミレートしてください. 25 | 26 | ## インストール 27 | KRAlertControllerは[CocoaPods](http://cocoapods.org)と[Carthage](https://github.com/Carthage/Carthage)で 28 | インストールすることができます. 29 | 30 | ```ruby 31 | # Podfile 32 | pod "KRAlertController" 33 | ``` 34 | 35 | ```ruby 36 | # Cartfile 37 | github "Krimpedance/KRAlertController" 38 | ``` 39 | 40 | ## 使い方 41 | (`/Demo`以下のサンプルを見てみてください) 42 | 43 | **大まかな使い方はUIAlertControllerと同じです.** 44 | 45 | まず, `KRAlertController`をインポートします. 46 | 47 | シンプルなアラートの表示 48 | 49 | ```Swift 50 | KRAlertController(title: "Title", message: "message") 51 | .addCancel() 52 | .addAction("OK") { action, textFields in 53 | print("OK") 54 | } 55 | .show() 56 | ``` 57 | 58 | ### イニシャライザ 59 | ```Swift 60 | init(title: String?, message: String?, style: KRAlertControllerStyle = .Alert) 61 | ``` 62 | 63 | ### アラートの種類 64 | KRAlertControllerには7種類のアラートがあります. 65 | 66 | それぞれ色やアイコンが異なり, 用途によって使い分けます. 67 | `icon`を`false`にすると, アイコンを非表示にできます. 68 | 69 | `presentingVC`には表示するViewControllerを設定します. 70 | 未設定の場合は, `keyWindow`の最前面のViewControllerに表示されます. 71 | 72 | ```Swift 73 | func show(presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 74 | func showSuccess(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 75 | func showInformation(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 76 | func showWarning(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 77 | func showError(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 78 | func showEdit(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 79 | func showAuthorize(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 80 | ``` 81 | 82 | ```Swift 83 | // Example 84 | alert.showSuccess(true) 85 | alert.showWarning(true, presentingVC: self, animated: false) { 86 | print("Showed warning alert!") 87 | } 88 | ``` 89 | 90 | ## ライブラリに関する質問等 91 | バグや機能のリクエストがありましたら, 気軽にコメントしてください. 92 | 93 | ## リリースノート 94 | + 3.1.0 : 95 | - Swift 4.2 に対応 96 | 97 | + 3.0.1 : 98 | - Swift 4.1 に対応 99 | 100 | + 3.0.0 : 101 | - Xcode9, Swift4 に対応 102 | 103 | ## ライセンス 104 | KRAlertControllerはMITライセンスに準拠しています. 105 | 106 | 詳しくは`LICENSE`ファイルをみてください. 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [日本語](./README_Ja.md) 2 | 3 | # KRAlertController 4 | 5 | [![Version](https://img.shields.io/cocoapods/v/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 6 | [![License](https://img.shields.io/cocoapods/l/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 7 | [![Platform](https://img.shields.io/cocoapods/p/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 8 | [![Download](https://img.shields.io/cocoapods/dt/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController) 9 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | [![CI Status](http://img.shields.io/travis/krimpedance/KRAlertController.svg?style=flat)](https://travis-ci.org/krimpedance/KRAlertController) 11 | 12 | `KRAlertController` is a beautiful and easy-to-use alert controller for your iOS written by Swift. 13 | 14 | 15 | 16 | ## Requirements 17 | - iOS 10.0+ 18 | - Xcode 10.0+ 19 | - Swift 4.2+ 20 | 21 | ## DEMO 22 | To run the example project, clone the repo, and open `KRAlertControllerDemo.xcodeproj` from the DEMO directory. 23 | 24 | or [appetize.io](https://appetize.io/app/jc2066a1jncndy2uet7wkp0ykg) 25 | 26 | ## Installation 27 | KRAlertController is available through [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage). 28 | To install it, simply add the following line to your Podfile or Cartfile: 29 | 30 | ```ruby 31 | # Podfile 32 | pod "KRAlertController" 33 | ``` 34 | 35 | ```ruby 36 | # Cartfile 37 | github "Krimpedance/KRAlertController" 38 | ``` 39 | 40 | ## Usage 41 | (see sample Xcode project in /Demo) 42 | 43 | **Mainly the same as UIAlertController.** 44 | 45 | At first, import `KRAlertController` in your swift file. 46 | 47 | Show simple alert. 48 | 49 | ```Swift 50 | KRAlertController(title: "Title", message: "message") 51 | .addCancel() 52 | .addAction("OK") { action, textFields in 53 | print("OK") 54 | } 55 | .show() 56 | ``` 57 | 58 | ### Initializer 59 | ```Swift 60 | init(title: String?, message: String?, style: KRAlertControllerStyle = .Alert) 61 | ``` 62 | 63 | ### Alert types 64 | There is 7 kinds of alert. 65 | `icon` pass true to display glaph icon; otherwise, pass false. 66 | Default view controller to display alert is visible view controller of key window. 67 | ```Swift 68 | func show(presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 69 | func showSuccess(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 70 | func showInformation(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 71 | func showWarning(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 72 | func showError(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 73 | func showEdit(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 74 | func showAuthorize(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil) 75 | ``` 76 | 77 | ```Swift 78 | // Example 79 | alert.showSuccess(true) 80 | alert.showWarning(true, presentingVC: self, animated: false) { 81 | print("Showed warning alert!") 82 | } 83 | ``` 84 | 85 | ## Contributing to this project 86 | I'm seeking bug reports and feature requests. 87 | 88 | ## Release Note 89 | + 3.1.0 90 | - Compatible with Swift 4.2. 91 | 92 | + 3.0.1 93 | - Compatible with Swift 4.1. 94 | 95 | + 3.0.0 96 | - Supported Xcode9 and Swift4. 97 | 98 | ## License 99 | KRAlertController is available under the MIT license. See the LICENSE file for more info. 100 | -------------------------------------------------------------------------------- /KRAlertController.xcodeproj/xcshareddata/xcschemes/KRAlertController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // KRAlertControllerDemo 4 | // 5 | // Created by Ryunosuke Kirikihira on 2016/06/18. 6 | // Copyright © 2016年 Krimpedance. All rights reserved. 7 | // 8 | // swiftlint:disable cyclomatic_complexity 9 | 10 | import UIKit 11 | import KRAlertController 12 | 13 | class ViewController: UIViewController { 14 | 15 | @IBOutlet weak var alertStyleControl: UISegmentedControl! 16 | @IBOutlet weak var buttonNumControl: UISegmentedControl! 17 | @IBOutlet weak var displayIconControl: UISegmentedControl! 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | // Do any additional setup after loading the view, typically from a nib. 22 | } 23 | 24 | override func didReceiveMemoryWarning() { 25 | super.didReceiveMemoryWarning() 26 | // Dispose of any resources that can be recreated. 27 | } 28 | } 29 | 30 | /** 31 | * Actions ------------- 32 | */ 33 | extension ViewController { 34 | func getAlertText(_ index: Int, style: KRAlertControllerStyle) -> (title: String, message: String) { 35 | switch index { 36 | case 1: 37 | return ("Normal", "This is .Normal alert\nThis is default.") 38 | case 2: 39 | return ("Success", "This is .Success alert.") 40 | case 3: 41 | return ("Information", "This is .Information alert.") 42 | case 4: 43 | return ("Warning", "This is .Warning alert.") 44 | case 5: 45 | return ("Error", "This is .Error alert.") 46 | case 6: 47 | if style == .alert { return ("Edit", "This is .Edit alert.\nThis alert added single text field.") } else { return ("Edit", "This is .Edit alert.\nText fields can only use .Alert style.") } 48 | case 7: 49 | if style == .alert { return ("Authorize", "This is .Authorize alert.\nThis alert added two text field.") } else { return ("Edit", "This is .Authorize alert.\nText fields can only use .Alert style.") } 50 | default: 51 | return ("", "") 52 | } 53 | } 54 | } 55 | 56 | /** 57 | * Button actions ------------- 58 | */ 59 | extension ViewController { 60 | @IBAction func showAlertButtonTapped(_ sender: UIButton) { 61 | let isDisplayIcon = (displayIconControl.selectedSegmentIndex==0) ? true : false 62 | let alertStyle: KRAlertControllerStyle = (alertStyleControl.selectedSegmentIndex==0) ? .alert : .actionSheet 63 | let alertText = getAlertText(sender.tag, style: alertStyle) 64 | 65 | var alert: KRAlertController 66 | switch buttonNumControl.selectedSegmentIndex { 67 | case 0: 68 | alert = KRAlertController(title: alertText.title, message: alertText.message, style: alertStyle) 69 | .addAction(title: "OK") 70 | 71 | case 1: 72 | alert = KRAlertController(title: alertText.title, message: alertText.message, style: alertStyle) 73 | .addAction(title: "Button1") 74 | .addCancel() 75 | 76 | case 2: 77 | alert = KRAlertController(title: alertText.title, message: alertText.message, style: alertStyle) 78 | .addAction(title: "Button1") 79 | .addAction(title: "Button2") 80 | .addCancel() 81 | 82 | default: return 83 | } 84 | 85 | defer { 86 | switch sender.tag { 87 | case 1: alert.show() 88 | case 2: alert.showSuccess(icon: isDisplayIcon) 89 | case 3: alert.showInformation(icon: isDisplayIcon) 90 | case 4: alert.showWarning(icon: isDisplayIcon) 91 | case 5: alert.showError(icon: isDisplayIcon) 92 | case 6: alert.showEdit(icon: isDisplayIcon) 93 | case 7: alert.showAuthorize(icon: isDisplayIcon) 94 | default: break 95 | } 96 | } 97 | 98 | if alertStyle == .actionSheet { return } 99 | 100 | switch sender.tag { 101 | case 6: 102 | alert = alert.addTextField({ (textField) in 103 | textField.placeholder = "Your name" 104 | }) 105 | case 7: 106 | alert = alert .addTextField({ (textField) in 107 | textField.placeholder = "Email" 108 | }) 109 | .addTextField({ (textField) in 110 | textField.placeholder = "Password" 111 | textField.isSecureTextEntry = true 112 | }) 113 | default: break 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /KRAlertController/Classes/SupportFiles/KRAlertControllerEnumerates.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertControllerEnumerates.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | Constants indicating the type of alert to display. 12 | 13 | - Alert: An alert displayed modally for the app. 14 | - ActionSheet: An action sheet displayed in the context of the view controller that presented it. 15 | */ 16 | public enum KRAlertControllerStyle { 17 | case alert, actionSheet 18 | } 19 | 20 | /** 21 | Styles to apply to action buttons in an alert. 22 | 23 | - Default: Apply the default style to the action’s button. 24 | - Cancel: Apply a style that indicates the action cancels the operation and leaves things unchanged. 25 | - Destructive: Apply a style that indicates the action might change or delete data. 26 | */ 27 | public enum KRAlertActionStyle: Int { 28 | case `default` 29 | case cancel 30 | case destructive 31 | } 32 | 33 | /** 34 | Styles to apply to labels in an alert 35 | 36 | - Title: Title label 37 | - Message: Message label 38 | */ 39 | enum KRAlertLabelStyle { 40 | case title, message 41 | } 42 | 43 | /** 44 | Type to apply to style of action buttons in an alert. 45 | 46 | - Vertical: Action buttons are displaying in line. 47 | - VerticalTable: Action buttons are displaying in line with table view. 48 | - Horizontal: Action buttons are displaying in a row. 49 | */ 50 | enum KRButtonLayoutType { 51 | case vertical 52 | case verticalTable 53 | case horizontal 54 | } 55 | 56 | /** 57 | Constants indicating the color of alert to display. Alert icon is indicated by `icon` parameter. 58 | 59 | - Normal: Display black text. This is default. 60 | - Success: Display green text and success icon. 61 | - Information: Display blue text and information icon. 62 | - Warning: Display yellow text and warning icon. 63 | - Error: Display red text and error icon. 64 | - Edit: Display purple text and edit icon. 65 | - Authorize: Display purple text and authorize icon. 66 | */ 67 | enum KRAlertControllerType { 68 | case normal 69 | case success(icon: Bool) 70 | case information(icon: Bool) 71 | case warning(icon: Bool) 72 | case error(icon: Bool) 73 | case edit(icon: Bool) 74 | case authorize(icon: Bool) 75 | 76 | var textColor: UIColor { 77 | switch self { 78 | case .normal: return .black 79 | case .success: return UIColor ( red: 0.1843, green: 0.3922, blue: 0.1804, alpha: 1.0 ) 80 | case .information: return UIColor ( red: 0.1922, green: 0.4392, blue: 0.5608, alpha: 1.0 ) 81 | case .warning: return UIColor ( red: 0.4627, green: 0.3529, blue: 0.1765, alpha: 1.0 ) 82 | case .error: return UIColor ( red: 0.5882, green: 0.1882, blue: 0.1961, alpha: 1.0 ) 83 | case .edit: return UIColor ( red: 0.5176, green: 0.2431, blue: 0.5922, alpha: 1.0 ) 84 | case .authorize: return UIColor ( red: 0.5961, green: 0.3373, blue: 0.6588, alpha: 1.0 ) 85 | } 86 | } 87 | 88 | var buttonBackgroundColor: UIColor { 89 | switch self { 90 | case .normal: return UIColor ( red: 0.8902, green: 0.8902, blue: 0.898, alpha: 1.0 ) 91 | case .success: return UIColor ( red: 0.8745, green: 0.9412, blue: 0.8471, alpha: 1.0 ) 92 | case .information: return UIColor ( red: 0.851, green: 0.9294, blue: 0.9686, alpha: 1.0 ) 93 | case .warning: return UIColor ( red: 0.9882, green: 0.9725, blue: 0.8902, alpha: 1.0 ) 94 | case .error: return UIColor ( red: 0.949, green: 0.8706, blue: 0.8706, alpha: 1.0 ) 95 | case .edit: return UIColor ( red: 0.9333, green: 0.8549, blue: 0.949, alpha: 1.0 ) 96 | case .authorize: return UIColor ( red: 0.9333, green: 0.8549, blue: 0.949, alpha: 1.0 ) 97 | } 98 | } 99 | 100 | var iconColor: UIColor { 101 | switch self { 102 | case .normal: return .black 103 | case .success: return UIColor ( red: 0.8039, green: 0.898, blue: 0.7412, alpha: 1.0 ) 104 | case .information: return UIColor ( red: 0.7373, green: 0.8863, blue: 0.9294, alpha: 1.0 ) 105 | case .warning: return UIColor ( red: 0.949, green: 0.902, blue: 0.7529, alpha: 1.0 ) 106 | case .error: return UIColor ( red: 0.9294, green: 0.7725, blue: 0.7725, alpha: 1.0 ) 107 | case .edit: return UIColor ( red: 0.9059, green: 0.8078, blue: 0.9294, alpha: 1.0 ) 108 | case .authorize: return UIColor ( red: 0.9059, green: 0.8078, blue: 0.9294, alpha: 1.0 ) 109 | } 110 | } 111 | 112 | var isShowIcon: Bool { 113 | switch self { 114 | case let .success(icon: isShow): return isShow 115 | case let .information(icon: isShow): return isShow 116 | case let .warning(icon: isShow): return isShow 117 | case let .error(icon: isShow): return isShow 118 | case let .edit(icon: isShow): return isShow 119 | case let .authorize(icon: isShow): return isShow 120 | default: return false 121 | } 122 | } 123 | 124 | func getIconLayer(rect: CGRect) -> CAShapeLayer { 125 | let layer = CAShapeLayer() 126 | layer.frame = rect 127 | layer.path = KRAlertIconPath.getPath(self, size: rect.size) 128 | layer.fillColor = iconColor.cgColor 129 | return layer 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertContentView/KRAlertContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertContentView.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * This Method is called when tapping some buttons. 12 | */ 13 | protocol KRAlertViewDelegate: class { 14 | func didSelectActionButton(action: KRAlertAction) 15 | } 16 | 17 | /** 18 | * KRAlertContentView is contents that display. 19 | */ 20 | class KRAlertContentView: UIView { 21 | let titleLabel = UILabel() 22 | let messageLabel = UILabel() 23 | let textFieldView = KRAlertTextFieldView() 24 | 25 | var style = KRAlertControllerStyle.alert 26 | var type = KRAlertControllerType.normal 27 | var actions = [KRAlertAction]() 28 | var textFields = [UITextField]() 29 | 30 | weak var delegate: KRAlertViewDelegate? 31 | 32 | var buttonLayoutType: KRButtonLayoutType { 33 | switch actions.count { 34 | case let count where count>5: 35 | return .verticalTable 36 | case 2: 37 | if style == .alert { 38 | return .horizontal 39 | } else { 40 | return .vertical 41 | } 42 | default: 43 | return .vertical 44 | } 45 | } 46 | 47 | init(title: String?, message: String?, actions: [KRAlertAction], textFields: [UITextField], style: KRAlertControllerStyle, type: KRAlertControllerType) { 48 | self.actions = actions 49 | self.textFields = textFields 50 | self.style = style 51 | self.type = type 52 | switch style { 53 | case .alert: 54 | super.init(frame: CGRect(x: 0, y: 0, width: 270, height: 0)) 55 | case .actionSheet: 56 | let screenSize = UIScreen.main.bounds.size 57 | super.init(frame: CGRect(x: 0, y: 0, width: screenSize.width-20*2, height: 0)) 58 | } 59 | setContents(title: title, message: message) 60 | } 61 | 62 | required init?(coder aDecoder: NSCoder) { 63 | fatalError("init(coder:) has not been implemented") 64 | } 65 | } 66 | 67 | /** 68 | * Calculated frame properties -------------------- 69 | */ 70 | private extension KRAlertContentView { 71 | var verticalMargin: CGFloat { return 10 } 72 | var horizontalMargin: CGFloat { return 10 } 73 | var marginBetweenContents: CGFloat { return 5 } 74 | 75 | var contentWidth: CGFloat { 76 | return frame.width - horizontalMargin*2 77 | } 78 | 79 | var contentHeight: CGFloat { 80 | let labelsHeight = titleFrame.height + marginBetweenContents + messageFrame.height 81 | 82 | var buttonsHeight: CGFloat 83 | switch buttonLayoutType { 84 | case .vertical: 85 | buttonsHeight = CGFloat(actions.count) * (buttonFrame().height + marginBetweenContents*2) - marginBetweenContents*2 86 | case .verticalTable: 87 | buttonsHeight = buttonTableFrame.height 88 | case .horizontal: 89 | buttonsHeight = buttonFrame().height 90 | } 91 | 92 | switch (textFields.count, actions.count) { 93 | case (0, 0): return labelsHeight 94 | case (_, 0): return labelsHeight + verticalMargin + textFieldViewFrame.height 95 | case (0, _): return labelsHeight + verticalMargin*2 + buttonsHeight 96 | default: return labelsHeight + verticalMargin*3 + textFieldViewFrame.height + buttonsHeight 97 | } 98 | } 99 | 100 | var titleFrame: CGRect { 101 | return CGRect(x: horizontalMargin, y: verticalMargin, width: contentWidth, height: titleLabel.bounds.height) 102 | } 103 | 104 | var messageFrame: CGRect { 105 | let yPos: CGFloat = titleLabel.frame.origin.y+titleLabel.bounds.height+marginBetweenContents 106 | return CGRect(x: horizontalMargin, y: yPos, width: contentWidth, height: messageLabel.bounds.height) 107 | } 108 | 109 | var textFieldViewFrame: CGRect { 110 | let yPos = messageFrame.origin.y + messageFrame.height + verticalMargin 111 | let height = CGFloat(textFields.count) * (30 + 1) 112 | return CGRect(x: horizontalMargin, y: yPos, width: contentWidth, height: height) 113 | } 114 | 115 | var buttonFrameYPosition: CGFloat { 116 | if textFields.count == 0 { 117 | return messageFrame.origin.y + messageFrame.height + verticalMargin*2 118 | } else { 119 | return textFieldViewFrame.origin.y + textFieldViewFrame.height + verticalMargin*2 120 | } 121 | } 122 | 123 | var buttonTableFrame: CGRect { 124 | let yPos = buttonFrameYPosition 125 | return CGRect(x: horizontalMargin, y: yPos, width: contentWidth, height: 230) 126 | } 127 | 128 | func buttonFrame(index: Int = 0) -> CGRect { 129 | let yPos = buttonFrameYPosition 130 | var point = CGPoint(x: horizontalMargin, y: yPos) 131 | var size = CGSize(width: contentWidth, height: 30) 132 | 133 | switch buttonLayoutType { 134 | case .vertical: 135 | point.y += CGFloat(index) * (marginBetweenContents*2 + size.height) 136 | case .verticalTable: 137 | return CGRect(origin: CGPoint.zero, size: size) 138 | case .horizontal: 139 | size.width = (contentWidth - horizontalMargin) / 2 140 | point.x += CGFloat(index) * (horizontalMargin + size.width) 141 | } 142 | 143 | return CGRect(origin: point, size: size) 144 | } 145 | } 146 | 147 | /** 148 | * Actions -------------------- 149 | */ 150 | private extension KRAlertContentView { 151 | func setContents(title: String?, message: String?) { 152 | titleLabel.configureLayout(frame: titleFrame, text: title, controllerType: type, labelStyle: .title) 153 | addSubview(titleLabel) 154 | messageLabel.configureLayout(frame: messageFrame, text: message, controllerType: type, labelStyle: .message) 155 | addSubview(messageLabel) 156 | if textFields.count>0 { 157 | textFieldView.configureLayout(textFieldViewFrame, textFields: textFields, controllerType: type) 158 | addSubview(textFieldView) 159 | } 160 | 161 | if type.isShowIcon { setIcon() } 162 | 163 | switch buttonLayoutType { 164 | case .verticalTable: 165 | setButtonTable() 166 | default: 167 | let buttons = getActionButtons() 168 | buttons.forEach { addSubview($0) } 169 | } 170 | 171 | autoresizingMask = [.flexibleTopMargin, .flexibleRightMargin, .flexibleBottomMargin, .flexibleLeftMargin] 172 | backgroundColor = .white 173 | layer.cornerRadius = 10 174 | var frame = self.frame 175 | frame.size.height = verticalMargin*2 + contentHeight 176 | self.frame = frame 177 | } 178 | 179 | func setIcon() { 180 | let height = messageLabel.frame.origin.y + messageLabel.frame.height - titleLabel.frame.origin.y 181 | let origin = CGPoint(x: center.x - height, y: titleLabel.frame.origin.y) 182 | let iconLayer = type.getIconLayer(rect: CGRect(origin: origin, size: CGSize(width: height*2, height: height))) 183 | iconLayer.zPosition = -1 184 | layer.addSublayer(iconLayer) 185 | } 186 | 187 | func setButtonTable() { 188 | let table = KRAlertButtonTable(frame: buttonTableFrame, buttons: getActionButtons()) 189 | addSubview(table) 190 | } 191 | 192 | func getActionButtons() -> [KRAlertButton] { 193 | var sortedActions = actions.filter({ $0.style != .cancel }) 194 | if let cancelAction = actions.filter({ $0.style == .cancel }).first { 195 | if buttonLayoutType == .horizontal && style == .alert { 196 | sortedActions.insert(cancelAction, at: 0) 197 | } else { 198 | sortedActions.append(cancelAction) 199 | } 200 | } 201 | 202 | let buttons = sortedActions.enumerated().map { index, action -> KRAlertButton in 203 | let button = KRAlertButton(frame: buttonFrame(index: index), action: action, type: type) 204 | button.addTarget(self, action: #selector(KRAlertContentView.actionButtonTapped(_:)), for: .touchUpInside) 205 | return button 206 | } 207 | return buttons 208 | } 209 | } 210 | 211 | /** 212 | * Button actions -------------------- 213 | */ 214 | extension KRAlertContentView { 215 | @objc func actionButtonTapped(_ button: KRAlertButton) { 216 | delegate?.didSelectActionButton(action: button.alertAction) 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /KRAlertController/Classes/SupportFiles/KRAlertIconPath.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertIconPath.swift 3 | // KRAlertController 4 | // 5 | // Copyright © 2016年 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | * KRAlertIconPath 12 | */ 13 | struct KRAlertIconPath { 14 | static func getPath(_ type: KRAlertControllerType, size: CGSize) -> CGPath { 15 | let path: UIBezierPath 16 | switch type { 17 | case .normal: path = UIBezierPath() 18 | case .success: path = success 19 | case .information: path = information 20 | case .warning: path = warning 21 | case .error: path = error 22 | case .edit: path = edit 23 | case .authorize: path = authorize 24 | } 25 | 26 | let defaultSize = CGSize(width: 200, height: 100) 27 | path.apply(CGAffineTransform(scaleX: size.width/defaultSize.width, y: size.height/defaultSize.height)) 28 | 29 | return path.cgPath 30 | } 31 | } 32 | 33 | /** 34 | * Paths -------- 35 | */ 36 | extension KRAlertIconPath { 37 | static var success: UIBezierPath { 38 | let path = UIBezierPath() 39 | path.move(to: CGPoint(x: 86.822, y: 100)) 40 | path.addLine(to: CGPoint(x: 37.596, y: 45.437)) 41 | path.addLine(to: CGPoint(x: 47.095, y: 36.868)) 42 | path.addLine(to: CGPoint(x: 86.377, y: 80.409)) 43 | path.addLine(to: CGPoint(x: 152.526, y: 0)) 44 | path.addLine(to: CGPoint(x: 162.404, y: 8.127)) 45 | path.addLine(to: CGPoint(x: 86.822, y: 100)) 46 | return path 47 | } 48 | 49 | static var information: UIBezierPath { 50 | let path = UIBezierPath() 51 | path.move(to: CGPoint(x: 109.804, y: 9.804)) 52 | path.addCurve(to: CGPoint(x: 100, y: 19.608), controlPoint1: CGPoint(x: 109.804, y: 15.218), controlPoint2: CGPoint(x: 105.415, y: 19.608)) 53 | path.addCurve(to: CGPoint(x: 90.196, y: 9.804), controlPoint1: CGPoint(x: 94.585, y: 19.608), controlPoint2: CGPoint(x: 90.196, y: 15.218)) 54 | path.addCurve(to: CGPoint(x: 100, y: 0), controlPoint1: CGPoint(x: 90.196, y: 4.389), controlPoint2: CGPoint(x: 94.585, y: 0)) 55 | path.addCurve(to: CGPoint(x: 109.804, y: 9.804), controlPoint1: CGPoint(x: 105.415, y: 0), controlPoint2: CGPoint(x: 109.804, y: 4.389)) 56 | path.move(to: CGPoint(x: 107.843, y: 96.078)) 57 | path.addLine(to: CGPoint(x: 107.843, y: 33.333)) 58 | path.addLine(to: CGPoint(x: 84.314, y: 33.333)) 59 | path.addLine(to: CGPoint(x: 84.314, y: 37.255)) 60 | path.addLine(to: CGPoint(x: 92.157, y: 37.255)) 61 | path.addLine(to: CGPoint(x: 92.157, y: 96.078)) 62 | path.addLine(to: CGPoint(x: 84.314, y: 96.078)) 63 | path.addLine(to: CGPoint(x: 84.314, y: 100)) 64 | path.addLine(to: CGPoint(x: 115.686, y: 100)) 65 | path.addLine(to: CGPoint(x: 115.686, y: 96.078)) 66 | path.addLine(to: CGPoint(x: 107.843, y: 96.078)) 67 | return path 68 | } 69 | 70 | static var warning: UIBezierPath { 71 | let path = UIBezierPath() 72 | path.move(to: CGPoint(x: 98.889, y: 66.667)) 73 | path.addCurve(to: CGPoint(x: 98.027, y: 63.802), controlPoint1: CGPoint(x: 98.889, y: 66.667), controlPoint2: CGPoint(x: 98.575, y: 65.625)) 74 | path.addCurve(to: CGPoint(x: 97.107, y: 60.514), controlPoint1: CGPoint(x: 97.751, y: 62.891), controlPoint2: CGPoint(x: 97.442, y: 61.784)) 75 | path.addCurve(to: CGPoint(x: 95.978, y: 56.25), controlPoint1: CGPoint(x: 96.774, y: 59.245), controlPoint2: CGPoint(x: 96.355, y: 57.813)) 76 | path.addCurve(to: CGPoint(x: 93.436, y: 45.573), controlPoint1: CGPoint(x: 95.21, y: 53.125), controlPoint2: CGPoint(x: 94.299, y: 49.479)) 77 | path.addCurve(to: CGPoint(x: 91.111, y: 33.333), controlPoint1: CGPoint(x: 92.574, y: 41.667), controlPoint2: CGPoint(x: 91.809, y: 37.5)) 78 | path.addCurve(to: CGPoint(x: 89.575, y: 27.116), controlPoint1: CGPoint(x: 90.758, y: 31.25), controlPoint2: CGPoint(x: 90.174, y: 29.167)) 79 | path.addCurve(to: CGPoint(x: 88.423, y: 21.094), controlPoint1: CGPoint(x: 88.984, y: 25.065), controlPoint2: CGPoint(x: 88.472, y: 23.047)) 80 | path.addCurve(to: CGPoint(x: 89.212, y: 15.462), controlPoint1: CGPoint(x: 88.376, y: 19.141), controlPoint2: CGPoint(x: 88.68, y: 17.253)) 81 | path.addCurve(to: CGPoint(x: 91.078, y: 10.417), controlPoint1: CGPoint(x: 89.692, y: 13.672), controlPoint2: CGPoint(x: 90.333, y: 11.979)) 82 | path.addCurve(to: CGPoint(x: 93.489, y: 6.152), controlPoint1: CGPoint(x: 91.794, y: 8.854), controlPoint2: CGPoint(x: 92.644, y: 7.422)) 83 | path.addCurve(to: CGPoint(x: 96.016, y: 2.865), controlPoint1: CGPoint(x: 94.304, y: 4.883), controlPoint2: CGPoint(x: 95.238, y: 3.776)) 84 | path.addCurve(to: CGPoint(x: 98.053, y: 0.749), controlPoint1: CGPoint(x: 96.805, y: 1.953), controlPoint2: CGPoint(x: 97.506, y: 1.237)) 85 | path.addCurve(to: CGPoint(x: 98.889, y: 0), controlPoint1: CGPoint(x: 98.598, y: 0.26), controlPoint2: CGPoint(x: 98.889, y: 0)) 86 | path.addLine(to: CGPoint(x: 101.111, y: 0)) 87 | path.addCurve(to: CGPoint(x: 101.947, y: 0.749), controlPoint1: CGPoint(x: 101.111, y: 0), controlPoint2: CGPoint(x: 101.402, y: 0.26)) 88 | path.addCurve(to: CGPoint(x: 103.984, y: 2.865), controlPoint1: CGPoint(x: 102.494, y: 1.237), controlPoint2: CGPoint(x: 103.195, y: 1.953)) 89 | path.addCurve(to: CGPoint(x: 106.511, y: 6.152), controlPoint1: CGPoint(x: 104.762, y: 3.776), controlPoint2: CGPoint(x: 105.696, y: 4.883)) 90 | path.addCurve(to: CGPoint(x: 108.922, y: 10.417), controlPoint1: CGPoint(x: 107.356, y: 7.422), controlPoint2: CGPoint(x: 108.206, y: 8.854)) 91 | path.addCurve(to: CGPoint(x: 110.788, y: 15.462), controlPoint1: CGPoint(x: 109.667, y: 11.979), controlPoint2: CGPoint(x: 110.308, y: 13.672)) 92 | path.addCurve(to: CGPoint(x: 111.577, y: 21.094), controlPoint1: CGPoint(x: 111.32, y: 17.253), controlPoint2: CGPoint(x: 111.624, y: 19.141)) 93 | path.addCurve(to: CGPoint(x: 110.425, y: 27.116), controlPoint1: CGPoint(x: 111.528, y: 23.047), controlPoint2: CGPoint(x: 111.016, y: 25.065)) 94 | path.addCurve(to: CGPoint(x: 108.889, y: 33.333), controlPoint1: CGPoint(x: 109.826, y: 29.167), controlPoint2: CGPoint(x: 109.242, y: 31.25)) 95 | path.addCurve(to: CGPoint(x: 106.564, y: 45.573), controlPoint1: CGPoint(x: 108.191, y: 37.5), controlPoint2: CGPoint(x: 107.426, y: 41.667)) 96 | path.addCurve(to: CGPoint(x: 104.022, y: 56.25), controlPoint1: CGPoint(x: 105.701, y: 49.479), controlPoint2: CGPoint(x: 104.79, y: 53.125)) 97 | path.addCurve(to: CGPoint(x: 102.893, y: 60.514), controlPoint1: CGPoint(x: 103.645, y: 57.813), controlPoint2: CGPoint(x: 103.226, y: 59.245)) 98 | path.addCurve(to: CGPoint(x: 101.973, y: 63.802), controlPoint1: CGPoint(x: 102.558, y: 61.784), controlPoint2: CGPoint(x: 102.249, y: 62.891)) 99 | path.addCurve(to: CGPoint(x: 101.111, y: 66.667), controlPoint1: CGPoint(x: 101.424, y: 65.625), controlPoint2: CGPoint(x: 101.111, y: 66.667)) 100 | path.addLine(to: CGPoint(x: 98.889, y: 66.667)) 101 | path.move(to: CGPoint(x: 110.714, y: 89.286)) 102 | path.addCurve(to: CGPoint(x: 100, y: 100), controlPoint1: CGPoint(x: 110.714, y: 95.203), controlPoint2: CGPoint(x: 105.917, y: 100)) 103 | path.addCurve(to: CGPoint(x: 89.286, y: 89.286), controlPoint1: CGPoint(x: 94.083, y: 100), controlPoint2: CGPoint(x: 89.286, y: 95.203)) 104 | path.addCurve(to: CGPoint(x: 100, y: 78.571), controlPoint1: CGPoint(x: 89.286, y: 83.368), controlPoint2: CGPoint(x: 94.083, y: 78.571)) 105 | path.addCurve(to: CGPoint(x: 110.714, y: 89.286), controlPoint1: CGPoint(x: 105.917, y: 78.571), controlPoint2: CGPoint(x: 110.714, y: 83.368)) 106 | return path 107 | } 108 | 109 | static var error: UIBezierPath { 110 | let path = UIBezierPath() 111 | path.move(to: CGPoint(x: 150, y: 15.021)) 112 | path.addLine(to: CGPoint(x: 134.979, y: 0)) 113 | path.addLine(to: CGPoint(x: 100, y: 34.979)) 114 | path.addLine(to: CGPoint(x: 65.021, y: 0)) 115 | path.addLine(to: CGPoint(x: 50, y: 15.021)) 116 | path.addLine(to: CGPoint(x: 84.979, y: 50)) 117 | path.addLine(to: CGPoint(x: 50, y: 84.979)) 118 | path.addLine(to: CGPoint(x: 65.021, y: 100)) 119 | path.addLine(to: CGPoint(x: 100, y: 65.021)) 120 | path.addLine(to: CGPoint(x: 134.979, y: 100)) 121 | path.addLine(to: CGPoint(x: 150, y: 84.979)) 122 | path.addLine(to: CGPoint(x: 115.021, y: 50)) 123 | path.addLine(to: CGPoint(x: 150, y: 15.021)) 124 | return path 125 | } 126 | 127 | static var edit: UIBezierPath { 128 | let path = UIBezierPath() 129 | path.move(to: CGPoint(x: 147.86, y: 22.823)) 130 | path.addLine(to: CGPoint(x: 137.516, y: 33.165)) 131 | path.addLine(to: CGPoint(x: 116.834, y: 12.483)) 132 | path.addLine(to: CGPoint(x: 127.178, y: 2.141)) 133 | path.addCurve(to: CGPoint(x: 132.346, y: -0.001), controlPoint1: CGPoint(x: 128.557, y: 0.756), controlPoint2: CGPoint(x: 130.392, y: -0.001)) 134 | path.addCurve(to: CGPoint(x: 137.52, y: 2.141), controlPoint1: CGPoint(x: 134.299, y: -0.001), controlPoint2: CGPoint(x: 136.137, y: 0.763)) 135 | path.addLine(to: CGPoint(x: 147.861, y: 12.483)) 136 | path.addCurve(to: CGPoint(x: 150, y: 17.653), controlPoint1: CGPoint(x: 149.243, y: 13.861), controlPoint2: CGPoint(x: 150, y: 15.697)) 137 | path.addCurve(to: CGPoint(x: 147.86, y: 22.823), controlPoint1: CGPoint(x: 149.999, y: 19.603), controlPoint2: CGPoint(x: 149.239, y: 21.445)) 138 | path.move(to: CGPoint(x: 85.083, y: 85.598)) 139 | path.addCurve(to: CGPoint(x: 77.892, y: 90.547), controlPoint1: CGPoint(x: 84.255, y: 86.383), controlPoint2: CGPoint(x: 81.391, y: 88.319)) 140 | path.addLine(to: CGPoint(x: 58.946, y: 71.6)) 141 | path.addCurve(to: CGPoint(x: 64.384, y: 64.929), controlPoint1: CGPoint(x: 60.888, y: 68.936), controlPoint2: CGPoint(x: 63.052, y: 66.258)) 142 | path.addLine(to: CGPoint(x: 111.664, y: 17.653)) 143 | path.addLine(to: CGPoint(x: 132.346, y: 38.335)) 144 | path.addLine(to: CGPoint(x: 85.083, y: 85.598)) 145 | path.move(to: CGPoint(x: 50, y: 100.001)) 146 | path.addLine(to: CGPoint(x: 54.749, y: 79.02)) 147 | path.addCurve(to: CGPoint(x: 54.895, y: 78.113), controlPoint1: CGPoint(x: 54.816, y: 78.72), controlPoint2: CGPoint(x: 54.867, y: 78.413)) 148 | path.addCurve(to: CGPoint(x: 54.966, y: 77.963), controlPoint1: CGPoint(x: 54.91, y: 78.07), controlPoint2: CGPoint(x: 54.949, y: 78.006)) 149 | path.addLine(to: CGPoint(x: 71.503, y: 94.503)) 150 | path.addCurve(to: CGPoint(x: 69.846, y: 95.503), controlPoint1: CGPoint(x: 70.95, y: 94.838), controlPoint2: CGPoint(x: 70.392, y: 95.174)) 151 | path.addLine(to: CGPoint(x: 50, y: 100.001)) 152 | return path 153 | } 154 | 155 | static var authorize: UIBezierPath { 156 | let path = UIBezierPath() 157 | path.move(to: CGPoint(x: 104.701, y: 86.517)) 158 | path.addLine(to: CGPoint(x: 93.535, y: 86.517)) 159 | path.addLine(to: CGPoint(x: 96.379, y: 71.054)) 160 | path.addCurve(to: CGPoint(x: 93.535, y: 66.294), controlPoint1: CGPoint(x: 94.707, y: 70.086), controlPoint2: CGPoint(x: 93.535, y: 68.354)) 161 | path.addCurve(to: CGPoint(x: 99.117, y: 60.704), controlPoint1: CGPoint(x: 93.535, y: 63.206), controlPoint2: CGPoint(x: 96.037, y: 60.704)) 162 | path.addCurve(to: CGPoint(x: 104.701, y: 66.294), controlPoint1: CGPoint(x: 102.199, y: 60.704), controlPoint2: CGPoint(x: 104.701, y: 63.206)) 163 | path.addCurve(to: CGPoint(x: 101.856, y: 71.054), controlPoint1: CGPoint(x: 104.701, y: 68.354), controlPoint2: CGPoint(x: 103.528, y: 70.086)) 164 | path.addLine(to: CGPoint(x: 104.701, y: 86.517)) 165 | path.addLine(to: CGPoint(x: 104.701, y: 100)) 166 | path.addLine(to: CGPoint(x: 137.077, y: 100)) 167 | path.addLine(to: CGPoint(x: 137.077, y: 39.329)) 168 | path.addLine(to: CGPoint(x: 83.147, y: 39.329)) 169 | path.addLine(to: CGPoint(x: 83.147, y: 29.914)) 170 | path.addCurve(to: CGPoint(x: 100, y: 13.483), controlPoint1: CGPoint(x: 83.147, y: 21.007), controlPoint2: CGPoint(x: 90.862, y: 13.483)) 171 | path.addCurve(to: CGPoint(x: 116.853, y: 29.914), controlPoint1: CGPoint(x: 109.138, y: 13.483), controlPoint2: CGPoint(x: 116.853, y: 21.007)) 172 | path.addLine(to: CGPoint(x: 116.853, y: 39.329)) 173 | path.addLine(to: CGPoint(x: 130.336, y: 39.329)) 174 | path.addLine(to: CGPoint(x: 130.336, y: 29.914)) 175 | path.addCurve(to: CGPoint(x: 100, y: 0), controlPoint1: CGPoint(x: 130.336, y: 13.416), controlPoint2: CGPoint(x: 116.734, y: 0)) 176 | path.addCurve(to: CGPoint(x: 69.664, y: 29.914), controlPoint1: CGPoint(x: 83.278, y: 0), controlPoint2: CGPoint(x: 69.664, y: 13.416)) 177 | path.addLine(to: CGPoint(x: 69.664, y: 39.329)) 178 | path.addLine(to: CGPoint(x: 62.923, y: 39.329)) 179 | path.addLine(to: CGPoint(x: 62.923, y: 100)) 180 | path.addLine(to: CGPoint(x: 104.701, y: 100)) 181 | path.addLine(to: CGPoint(x: 104.701, y: 86.517)) 182 | return path 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /KRAlertController/Classes/KRAlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRAlertContoller.swift 3 | // 4 | // Copyright © 2016年 Krimpedance. All rights reserved. 5 | // 6 | 7 | import UIKit 8 | 9 | /** 10 | * KRAlertController is a beautiful and easy-to-use alert controller 11 | * A KRAlertController object displays an alert message to the user. 12 | * After configuring the alert controller with the actions and style you want, present it using the `show()` method. 13 | */ 14 | public final class KRAlertController { 15 | /// Alert title 16 | public var title: String? 17 | /// Alert message 18 | public var message: String? 19 | /// Alert style (read only) 20 | public fileprivate(set) var style = KRAlertControllerStyle.alert 21 | /// The actions that the user can take in response to the alert or action sheet. (read-only) 22 | public fileprivate(set) var actions = [KRAlertAction]() 23 | /// The array of text fields displayed by the alert. (read-only) 24 | public fileprivate(set) var textFields = [UITextField]() 25 | 26 | /** 27 | Creates and returns a controller for displaying an alert to the user. Default alert type is `.Normal`. 28 | 29 | - parameter title: The title of the alert. 30 | - parameter message: Descriptive text that provides additional details about the reason for the alert. 31 | - parameter style: Constants indicating the type of alert to display. 32 | */ 33 | public convenience init(title: String?, message: String?, style: KRAlertControllerStyle = .alert) { 34 | self.init() 35 | self.title = title 36 | self.message = message 37 | self.style = style 38 | } 39 | } 40 | 41 | /** 42 | * Add Actions ------------- 43 | */ 44 | extension KRAlertController { 45 | /** 46 | Attaches an cancel action object to the alert or action sheet. 47 | 48 | - parameter title: Cancel button title. 49 | - parameter handler: Cancel button action handler. 50 | 51 | - returns: KRAlertController object. 52 | */ 53 | public func addCancel(title: String="Cancel", handler: KRAlertActionHandler? = nil) -> KRAlertController { 54 | let action = KRAlertAction(title: title, style: .cancel, isPreferred: true, handler: handler) 55 | if actions.contains(where: { $0.style == .cancel }) { 56 | fatalError("KRAlertController can only have one action with a style of KRAlertActionStyle.Cancel") 57 | } 58 | actions.append(action) 59 | return self 60 | } 61 | 62 | /** 63 | Attaches an destructive action object to the alert or action sheet. 64 | 65 | - parameter title: Destructive button title. 66 | - parameter isPreferred: When true, Action title become preferred style. 67 | - parameter handler: Destructive button action handler. 68 | 69 | - returns: KRAlertController object. 70 | */ 71 | public func addDestructive(title: String, isPreferred: Bool = false, handler: KRAlertActionHandler? = nil) -> KRAlertController { 72 | let action = KRAlertAction(title: title, style: .destructive, isPreferred: isPreferred, handler: handler) 73 | actions.append(action) 74 | return self 75 | } 76 | 77 | /** 78 | Attaches an action object to the alert or action sheet. 79 | 80 | - parameter title: Button title. 81 | - parameter isPreferred: When true, Action title become preferred style. 82 | - parameter handler: Button action handler. 83 | 84 | - returns: KRAlertController object. 85 | */ 86 | public func addAction(title: String, isPreferred: Bool = false, handler: KRAlertActionHandler? = nil) -> KRAlertController { 87 | let action = KRAlertAction(title: title, style: .default, isPreferred: isPreferred, handler: handler) 88 | actions.append(action) 89 | return self 90 | } 91 | 92 | /** 93 | Adds a text field to an alert. But several setting would be reset. 94 | - Frame 95 | - Font size 96 | - Border width 97 | - Border color 98 | - Text color 99 | - Placeholder color 100 | 101 | - parameter configurationHandler: A block for configuring the text field prior to displaying the alert. 102 | 103 | - returns: KRAlertController object. 104 | */ 105 | public func addTextField(_ configurationHandler: ((_ textField: UITextField) -> Void)? = nil) -> KRAlertController { 106 | assert(style == .alert, "Text fields can only be added to an alert controller of style KRAlertControllerStyle.Alert") 107 | assert(textFields.count < 3, "KRAlertController can add text fields up to 3") 108 | 109 | let textField = UITextField() 110 | configurationHandler?(textField) 111 | textFields.append(textField) 112 | 113 | return self 114 | } 115 | } 116 | 117 | /** 118 | * Show actions ------------ 119 | */ 120 | extension KRAlertController { 121 | /** 122 | Display alert. Default view controller to display alert is visible view controller of key window. 123 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 124 | 125 | - parameter presentingVC: The view controller to display over the current view controller’s content. 126 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 127 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 128 | 129 | - returns: No return value 130 | */ 131 | public func show(presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 132 | show(.normal, presentingVC: presentingVC, animated: animated, completion: completion) 133 | } 134 | 135 | /** 136 | Display success alert. Default view controller to display alert is visible view controller of key window. 137 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 138 | 139 | - parameter icon: Pass true to display success glaph icon; otherwise, pass false.. 140 | - parameter presentingVC: The view controller to display over the current view controller’s content. 141 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 142 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 143 | 144 | - returns: No return value 145 | */ 146 | public func showSuccess(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 147 | show(.success(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 148 | } 149 | 150 | /** 151 | Display information alert. Default view controller to display alert is visible view controller of key window. 152 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 153 | 154 | - parameter icon: Pass true to display information glaph icon; otherwise, pass false.. 155 | - parameter presentingVC: The view controller to display over the current view controller’s content. 156 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 157 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 158 | 159 | - returns: No return value 160 | */ 161 | public func showInformation(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 162 | show(.information(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 163 | } 164 | 165 | /** 166 | Display warning alert. Default view controller to display alert is visible view controller of key window. 167 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 168 | 169 | - parameter icon: Pass true to display warning glaph icon; otherwise, pass false.. 170 | - parameter presentingVC: The view controller to display over the current view controller’s content. 171 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 172 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 173 | 174 | - returns: No return value 175 | */ 176 | public func showWarning(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 177 | show(.warning(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 178 | } 179 | 180 | /** 181 | Display error alert. Default view controller to display alert is visible view controller of key window. 182 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 183 | 184 | - parameter icon: Pass true to display error glaph icon; otherwise, pass false.. 185 | - parameter presentingVC: The view controller to display over the current view controller’s content. 186 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 187 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 188 | 189 | - returns: No return value 190 | */ 191 | public func showError(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 192 | show(.error(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 193 | } 194 | 195 | /** 196 | Display edit alert. Default view controller to display alert is visible view controller of key window. 197 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 198 | 199 | - parameter icon: Pass true to display edit glaph icon; otherwise, pass false.. 200 | - parameter presentingVC: The view controller to display over the current view controller’s content. 201 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 202 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 203 | 204 | - returns: No return value 205 | */ 206 | public func showEdit(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 207 | show(.edit(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 208 | } 209 | 210 | /** 211 | Display authorize alert. Default view controller to display alert is visible view controller of key window. 212 | The completion handler is called after the viewDidAppear: method is called on the presented view controller. 213 | 214 | - parameter icon: Pass true to display authorize glaph icon; otherwise, pass false.. 215 | - parameter presentingVC: The view controller to display over the current view controller’s content. 216 | - parameter animated: Pass true to animate the presentation; otherwise, pass false. 217 | - parameter completion: The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 218 | 219 | - returns: No return value 220 | */ 221 | public func showAuthorize(icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 222 | show(.authorize(icon: icon), presentingVC: presentingVC, animated: animated, completion: completion) 223 | } 224 | } 225 | 226 | /** 227 | * Private actions ------------ 228 | */ 229 | extension KRAlertController { 230 | fileprivate func show(_ type: KRAlertControllerType, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 231 | guard let viewController = presentingVC ?? UIApplication.shared.topViewController() else { 232 | print("View controller to present alert controller isn't found!") 233 | return 234 | } 235 | 236 | let alertVC = makeAlertViewController(type) 237 | alertVC.statusBarHidden = viewController.prefersStatusBarHidden 238 | 239 | viewController.present(alertVC, animated: false) { 240 | UIView.animate(withDuration: 0.2, animations: { 241 | alertVC.showContent() 242 | }) 243 | } 244 | } 245 | 246 | fileprivate func makeAlertViewController(_ type: KRAlertControllerType) -> KRAlertBaseViewController { 247 | let baseVC = KRAlertBaseViewController(title: title, message: message, actions: actions, textFields: textFields, style: style, type: type) 248 | return baseVC 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B5714951D1512F00083C8FC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5714941D1512F00083C8FC /* AppDelegate.swift */; }; 11 | 4B5714971D1512F00083C8FC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5714961D1512F00083C8FC /* ViewController.swift */; }; 12 | 4B57149A1D1512F00083C8FC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B5714981D1512F00083C8FC /* Main.storyboard */; }; 13 | 4B57149C1D1512F00083C8FC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B57149B1D1512F00083C8FC /* Assets.xcassets */; }; 14 | 4B57149F1D1512F00083C8FC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B57149D1D1512F00083C8FC /* LaunchScreen.storyboard */; }; 15 | 4BAB3F251D1D134100949F4F /* UIViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB3F241D1D134100949F4F /* UIViewExtension.swift */; }; 16 | 4BAB3F2F1D1DAE5B00949F4F /* KRAlertController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B8125B11D151320002DFB93 /* KRAlertController.framework */; }; 17 | 4BAB3F301D1DAE5B00949F4F /* KRAlertController.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B8125B11D151320002DFB93 /* KRAlertController.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 4B8125B01D151320002DFB93 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */; 24 | proxyType = 2; 25 | remoteGlobalIDString = 4BA755521D149DD9007B06A5; 26 | remoteInfo = KRAlertController; 27 | }; 28 | 4B8125B21D151320002DFB93 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */; 31 | proxyType = 2; 32 | remoteGlobalIDString = 4BA7555C1D149DD9007B06A5; 33 | remoteInfo = KRAlertControllerTests; 34 | }; 35 | 4BAB3F311D1DAE5B00949F4F /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 4BA755511D149DD9007B06A5; 40 | remoteInfo = KRAlertController; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXCopyFilesBuildPhase section */ 45 | 4BAB3F331D1DAE5B00949F4F /* Embed Frameworks */ = { 46 | isa = PBXCopyFilesBuildPhase; 47 | buildActionMask = 2147483647; 48 | dstPath = ""; 49 | dstSubfolderSpec = 10; 50 | files = ( 51 | 4BAB3F301D1DAE5B00949F4F /* KRAlertController.framework in Embed Frameworks */, 52 | ); 53 | name = "Embed Frameworks"; 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXCopyFilesBuildPhase section */ 57 | 58 | /* Begin PBXFileReference section */ 59 | 4B5714911D1512F00083C8FC /* KRAlertControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KRAlertControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 4B5714941D1512F00083C8FC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 61 | 4B5714961D1512F00083C8FC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 62 | 4B5714991D1512F00083C8FC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 63 | 4B57149B1D1512F00083C8FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 64 | 4B57149E1D1512F00083C8FC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 65 | 4B5714A01D1512F00083C8FC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 66 | 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = KRAlertController.xcodeproj; path = ../KRAlertController.xcodeproj; sourceTree = ""; }; 67 | 4BAB3F241D1D134100949F4F /* UIViewExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewExtension.swift; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 4B57148E1D1512EF0083C8FC /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | 4BAB3F2F1D1DAE5B00949F4F /* KRAlertController.framework in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | /* End PBXFrameworksBuildPhase section */ 80 | 81 | /* Begin PBXGroup section */ 82 | 4B5714881D1512EF0083C8FC = { 83 | isa = PBXGroup; 84 | children = ( 85 | 4B5714931D1512F00083C8FC /* KRAlertControllerDemo */, 86 | 4B5714921D1512F00083C8FC /* Products */, 87 | 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 4B5714921D1512F00083C8FC /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 4B5714911D1512F00083C8FC /* KRAlertControllerDemo.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 4B5714931D1512F00083C8FC /* KRAlertControllerDemo */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 4B5714941D1512F00083C8FC /* AppDelegate.swift */, 103 | 4B5714961D1512F00083C8FC /* ViewController.swift */, 104 | 4BAB3F241D1D134100949F4F /* UIViewExtension.swift */, 105 | 4B5714981D1512F00083C8FC /* Main.storyboard */, 106 | 4B57149B1D1512F00083C8FC /* Assets.xcassets */, 107 | 4B57149D1D1512F00083C8FC /* LaunchScreen.storyboard */, 108 | 4B5714A01D1512F00083C8FC /* Info.plist */, 109 | ); 110 | path = KRAlertControllerDemo; 111 | sourceTree = ""; 112 | }; 113 | 4B8125AC1D151320002DFB93 /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 4B8125B11D151320002DFB93 /* KRAlertController.framework */, 117 | 4B8125B31D151320002DFB93 /* KRAlertControllerTests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 4B5714901D1512EF0083C8FC /* KRAlertControllerDemo */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 4B5714A31D1512F00083C8FC /* Build configuration list for PBXNativeTarget "KRAlertControllerDemo" */; 128 | buildPhases = ( 129 | 4B57148D1D1512EF0083C8FC /* Sources */, 130 | 4B57148E1D1512EF0083C8FC /* Frameworks */, 131 | 4B57148F1D1512EF0083C8FC /* Resources */, 132 | 4BAB3F331D1DAE5B00949F4F /* Embed Frameworks */, 133 | 6B661E981F73ACDE00F83184 /* ShellScript */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | 4BAB3F321D1DAE5B00949F4F /* PBXTargetDependency */, 139 | ); 140 | name = KRAlertControllerDemo; 141 | productName = KRAlertControllerDemo; 142 | productReference = 4B5714911D1512F00083C8FC /* KRAlertControllerDemo.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 4B5714891D1512EF0083C8FC /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastSwiftUpdateCheck = 0730; 152 | LastUpgradeCheck = 1000; 153 | ORGANIZATIONNAME = Krimpedance; 154 | TargetAttributes = { 155 | 4B5714901D1512EF0083C8FC = { 156 | CreatedOnToolsVersion = 7.3.1; 157 | LastSwiftMigration = 0800; 158 | }; 159 | }; 160 | }; 161 | buildConfigurationList = 4B57148C1D1512EF0083C8FC /* Build configuration list for PBXProject "KRAlertControllerDemo" */; 162 | compatibilityVersion = "Xcode 10.0"; 163 | developmentRegion = English; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | Base, 168 | ); 169 | mainGroup = 4B5714881D1512EF0083C8FC; 170 | productRefGroup = 4B5714921D1512F00083C8FC /* Products */; 171 | projectDirPath = ""; 172 | projectReferences = ( 173 | { 174 | ProductGroup = 4B8125AC1D151320002DFB93 /* Products */; 175 | ProjectRef = 4B8125AB1D151320002DFB93 /* KRAlertController.xcodeproj */; 176 | }, 177 | ); 178 | projectRoot = ""; 179 | targets = ( 180 | 4B5714901D1512EF0083C8FC /* KRAlertControllerDemo */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXReferenceProxy section */ 186 | 4B8125B11D151320002DFB93 /* KRAlertController.framework */ = { 187 | isa = PBXReferenceProxy; 188 | fileType = wrapper.framework; 189 | path = KRAlertController.framework; 190 | remoteRef = 4B8125B01D151320002DFB93 /* PBXContainerItemProxy */; 191 | sourceTree = BUILT_PRODUCTS_DIR; 192 | }; 193 | 4B8125B31D151320002DFB93 /* KRAlertControllerTests.xctest */ = { 194 | isa = PBXReferenceProxy; 195 | fileType = wrapper.cfbundle; 196 | path = KRAlertControllerTests.xctest; 197 | remoteRef = 4B8125B21D151320002DFB93 /* PBXContainerItemProxy */; 198 | sourceTree = BUILT_PRODUCTS_DIR; 199 | }; 200 | /* End PBXReferenceProxy section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | 4B57148F1D1512EF0083C8FC /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 4B57149F1D1512F00083C8FC /* LaunchScreen.storyboard in Resources */, 208 | 4B57149C1D1512F00083C8FC /* Assets.xcassets in Resources */, 209 | 4B57149A1D1512F00083C8FC /* Main.storyboard in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXShellScriptBuildPhase section */ 216 | 6B661E981F73ACDE00F83184 /* ShellScript */ = { 217 | isa = PBXShellScriptBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | ); 221 | inputPaths = ( 222 | ); 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 4B57148D1D1512EF0083C8FC /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 4BAB3F251D1D134100949F4F /* UIViewExtension.swift in Sources */, 237 | 4B5714971D1512F00083C8FC /* ViewController.swift in Sources */, 238 | 4B5714951D1512F00083C8FC /* AppDelegate.swift in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXTargetDependency section */ 245 | 4BAB3F321D1DAE5B00949F4F /* PBXTargetDependency */ = { 246 | isa = PBXTargetDependency; 247 | name = KRAlertController; 248 | targetProxy = 4BAB3F311D1DAE5B00949F4F /* PBXContainerItemProxy */; 249 | }; 250 | /* End PBXTargetDependency section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | 4B5714981D1512F00083C8FC /* Main.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 4B5714991D1512F00083C8FC /* Base */, 257 | ); 258 | name = Main.storyboard; 259 | sourceTree = ""; 260 | }; 261 | 4B57149D1D1512F00083C8FC /* LaunchScreen.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | 4B57149E1D1512F00083C8FC /* Base */, 265 | ); 266 | name = LaunchScreen.storyboard; 267 | sourceTree = ""; 268 | }; 269 | /* End PBXVariantGroup section */ 270 | 271 | /* Begin XCBuildConfiguration section */ 272 | 4B5714A11D1512F00083C8FC /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ALWAYS_SEARCH_USER_PATHS = NO; 276 | CLANG_ANALYZER_NONNULL = YES; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 282 | CLANG_WARN_BOOL_CONVERSION = YES; 283 | CLANG_WARN_COMMA = YES; 284 | CLANG_WARN_CONSTANT_CONVERSION = YES; 285 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 286 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 287 | CLANG_WARN_EMPTY_BODY = YES; 288 | CLANG_WARN_ENUM_CONVERSION = YES; 289 | CLANG_WARN_INFINITE_RECURSION = YES; 290 | CLANG_WARN_INT_CONVERSION = YES; 291 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 292 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 293 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 296 | CLANG_WARN_STRICT_PROTOTYPES = YES; 297 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 298 | CLANG_WARN_UNREACHABLE_CODE = YES; 299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 301 | COPY_PHASE_STRIP = NO; 302 | DEBUG_INFORMATION_FORMAT = dwarf; 303 | ENABLE_STRICT_OBJC_MSGSEND = YES; 304 | ENABLE_TESTABILITY = YES; 305 | GCC_C_LANGUAGE_STANDARD = gnu99; 306 | GCC_DYNAMIC_NO_PIC = NO; 307 | GCC_NO_COMMON_BLOCKS = YES; 308 | GCC_OPTIMIZATION_LEVEL = 0; 309 | GCC_PREPROCESSOR_DEFINITIONS = ( 310 | "DEBUG=1", 311 | "$(inherited)", 312 | ); 313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 315 | GCC_WARN_UNDECLARED_SELECTOR = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 317 | GCC_WARN_UNUSED_FUNCTION = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 320 | MTL_ENABLE_DEBUG_INFO = YES; 321 | ONLY_ACTIVE_ARCH = YES; 322 | SDKROOT = iphoneos; 323 | SWIFT_COMPILATION_MODE = singlefile; 324 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 325 | SWIFT_VERSION = 4.2; 326 | }; 327 | name = Debug; 328 | }; 329 | 4B5714A21D1512F00083C8FC /* Release */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_ANALYZER_NONNULL = YES; 334 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 335 | CLANG_CXX_LIBRARY = "libc++"; 336 | CLANG_ENABLE_MODULES = YES; 337 | CLANG_ENABLE_OBJC_ARC = YES; 338 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_COMMA = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_EMPTY_BODY = YES; 345 | CLANG_WARN_ENUM_CONVERSION = YES; 346 | CLANG_WARN_INFINITE_RECURSION = YES; 347 | CLANG_WARN_INT_CONVERSION = YES; 348 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 349 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 350 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 352 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 353 | CLANG_WARN_STRICT_PROTOTYPES = YES; 354 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 355 | CLANG_WARN_UNREACHABLE_CODE = YES; 356 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 357 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 358 | COPY_PHASE_STRIP = NO; 359 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 360 | ENABLE_NS_ASSERTIONS = NO; 361 | ENABLE_STRICT_OBJC_MSGSEND = YES; 362 | GCC_C_LANGUAGE_STANDARD = gnu99; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 365 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 366 | GCC_WARN_UNDECLARED_SELECTOR = YES; 367 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 368 | GCC_WARN_UNUSED_FUNCTION = YES; 369 | GCC_WARN_UNUSED_VARIABLE = YES; 370 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 371 | MTL_ENABLE_DEBUG_INFO = NO; 372 | SDKROOT = iphoneos; 373 | SWIFT_COMPILATION_MODE = wholemodule; 374 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 375 | SWIFT_VERSION = 4.2; 376 | VALIDATE_PRODUCT = YES; 377 | }; 378 | name = Release; 379 | }; 380 | 4B5714A41D1512F00083C8FC /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | DEVELOPMENT_TEAM = ""; 386 | INFOPLIST_FILE = KRAlertControllerDemo/Info.plist; 387 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 388 | LD_RUNPATH_SEARCH_PATHS = ( 389 | "$(inherited)", 390 | "@executable_path/Frameworks", 391 | ); 392 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertControllerDemo; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | SWIFT_VERSION = 4.2; 395 | }; 396 | name = Debug; 397 | }; 398 | 4B5714A51D1512F00083C8FC /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 402 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 403 | DEVELOPMENT_TEAM = ""; 404 | INFOPLIST_FILE = KRAlertControllerDemo/Info.plist; 405 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 406 | LD_RUNPATH_SEARCH_PATHS = ( 407 | "$(inherited)", 408 | "@executable_path/Frameworks", 409 | ); 410 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertControllerDemo; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | SWIFT_VERSION = 4.2; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | 4B57148C1D1512EF0083C8FC /* Build configuration list for PBXProject "KRAlertControllerDemo" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | 4B5714A11D1512F00083C8FC /* Debug */, 423 | 4B5714A21D1512F00083C8FC /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | 4B5714A31D1512F00083C8FC /* Build configuration list for PBXNativeTarget "KRAlertControllerDemo" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | 4B5714A41D1512F00083C8FC /* Debug */, 432 | 4B5714A51D1512F00083C8FC /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | /* End XCConfigurationList section */ 438 | }; 439 | rootObject = 4B5714891D1512EF0083C8FC /* Project object */; 440 | } 441 | -------------------------------------------------------------------------------- /KRAlertController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B53A29A1D1576A300EC2669 /* KRAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B53A2991D1576A300EC2669 /* KRAlertController.swift */; }; 11 | 4B53A29C1D1576D600EC2669 /* KRAlertControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B53A29B1D1576D600EC2669 /* KRAlertControllerExtensions.swift */; }; 12 | 4B5A5EA71D19140B00041FA5 /* KRAlertBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A5EA61D19140B00041FA5 /* KRAlertBaseViewController.swift */; }; 13 | 4B7576F31D1C33D3003FF258 /* KRAlertButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576F01D1C33D3003FF258 /* KRAlertButton.swift */; }; 14 | 4B7576F41D1C33D3003FF258 /* KRAlertButtonTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576F11D1C33D3003FF258 /* KRAlertButtonTable.swift */; }; 15 | 4B7576F51D1C33D3003FF258 /* KRAlertContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576F21D1C33D3003FF258 /* KRAlertContentView.swift */; }; 16 | 4B7576F81D1C392C003FF258 /* KRAlertIconPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576F71D1C392C003FF258 /* KRAlertIconPath.swift */; }; 17 | 4BA755561D149DD9007B06A5 /* KRAlertController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA755551D149DD9007B06A5 /* KRAlertController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 | 4BA7555D1D149DD9007B06A5 /* KRAlertController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA755521D149DD9007B06A5 /* KRAlertController.framework */; }; 19 | 4BA755621D149DD9007B06A5 /* KRAlertControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA755611D149DD9007B06A5 /* KRAlertControllerTests.swift */; }; 20 | 4BAB3F2A1D1D2C4200949F4F /* KRAlertTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB3F291D1D2C4200949F4F /* KRAlertTextFieldView.swift */; }; 21 | 4BB4B9561D15A30E004570F1 /* KRAlertAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4B9551D15A30E004570F1 /* KRAlertAction.swift */; }; 22 | 4BD66EE41D8A97490066BF6F /* KRAlertAction.swift in Headers */ = {isa = PBXBuildFile; fileRef = 4BB4B9551D15A30E004570F1 /* KRAlertAction.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 23 | 4BD66EE51D8A97490066BF6F /* KRAlertController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 4B53A2991D1576A300EC2669 /* KRAlertController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 24 | 4BF2395C1D1A428A0076415B /* KRAlertControllerEnumerates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF2395B1D1A428A0076415B /* KRAlertControllerEnumerates.swift */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 4BA7555E1D149DD9007B06A5 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 4BA755491D149DD9007B06A5 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 4BA755511D149DD9007B06A5; 33 | remoteInfo = KRAlertController; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 4B53A2991D1576A300EC2669 /* KRAlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertController.swift; sourceTree = ""; }; 39 | 4B53A29B1D1576D600EC2669 /* KRAlertControllerExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertControllerExtensions.swift; sourceTree = ""; }; 40 | 4B5A5EA61D19140B00041FA5 /* KRAlertBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertBaseViewController.swift; sourceTree = ""; }; 41 | 4B7576F01D1C33D3003FF258 /* KRAlertButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertButton.swift; sourceTree = ""; }; 42 | 4B7576F11D1C33D3003FF258 /* KRAlertButtonTable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertButtonTable.swift; sourceTree = ""; }; 43 | 4B7576F21D1C33D3003FF258 /* KRAlertContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertContentView.swift; sourceTree = ""; }; 44 | 4B7576F71D1C392C003FF258 /* KRAlertIconPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertIconPath.swift; sourceTree = ""; }; 45 | 4BA755521D149DD9007B06A5 /* KRAlertController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KRAlertController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 4BA755551D149DD9007B06A5 /* KRAlertController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KRAlertController.h; sourceTree = ""; }; 47 | 4BA755571D149DD9007B06A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 4BA7555C1D149DD9007B06A5 /* KRAlertControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KRAlertControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 4BA755611D149DD9007B06A5 /* KRAlertControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KRAlertControllerTests.swift; sourceTree = ""; }; 50 | 4BA755631D149DD9007B06A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 4BAB3F291D1D2C4200949F4F /* KRAlertTextFieldView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertTextFieldView.swift; sourceTree = ""; }; 52 | 4BB4B9551D15A30E004570F1 /* KRAlertAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertAction.swift; sourceTree = ""; }; 53 | 4BF2395B1D1A428A0076415B /* KRAlertControllerEnumerates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRAlertControllerEnumerates.swift; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 4BA7554E1D149DD9007B06A5 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 4BA755591D149DD9007B06A5 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 4BA7555D1D149DD9007B06A5 /* KRAlertController.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | 4B53A2981D1576A300EC2669 /* Classes */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 4BB4B9551D15A30E004570F1 /* KRAlertAction.swift */, 79 | 4B5A5EA61D19140B00041FA5 /* KRAlertBaseViewController.swift */, 80 | 4B53A2991D1576A300EC2669 /* KRAlertController.swift */, 81 | 4B7576EF1D1C33D3003FF258 /* KRAlertContentView */, 82 | 4B7576F61D1C3832003FF258 /* SupportFiles */, 83 | ); 84 | path = Classes; 85 | sourceTree = ""; 86 | }; 87 | 4B7576EF1D1C33D3003FF258 /* KRAlertContentView */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4B7576F01D1C33D3003FF258 /* KRAlertButton.swift */, 91 | 4B7576F11D1C33D3003FF258 /* KRAlertButtonTable.swift */, 92 | 4B7576F21D1C33D3003FF258 /* KRAlertContentView.swift */, 93 | 4BAB3F291D1D2C4200949F4F /* KRAlertTextFieldView.swift */, 94 | ); 95 | path = KRAlertContentView; 96 | sourceTree = ""; 97 | }; 98 | 4B7576F61D1C3832003FF258 /* SupportFiles */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 4BF2395B1D1A428A0076415B /* KRAlertControllerEnumerates.swift */, 102 | 4B53A29B1D1576D600EC2669 /* KRAlertControllerExtensions.swift */, 103 | 4B7576F71D1C392C003FF258 /* KRAlertIconPath.swift */, 104 | ); 105 | path = SupportFiles; 106 | sourceTree = ""; 107 | }; 108 | 4BA755481D149DD9007B06A5 = { 109 | isa = PBXGroup; 110 | children = ( 111 | 4BA755541D149DD9007B06A5 /* KRAlertController */, 112 | 4BA755601D149DD9007B06A5 /* KRAlertControllerTests */, 113 | 4BA755531D149DD9007B06A5 /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | 4BA755531D149DD9007B06A5 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 4BA755521D149DD9007B06A5 /* KRAlertController.framework */, 121 | 4BA7555C1D149DD9007B06A5 /* KRAlertControllerTests.xctest */, 122 | ); 123 | name = Products; 124 | sourceTree = ""; 125 | }; 126 | 4BA755541D149DD9007B06A5 /* KRAlertController */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 4B53A2981D1576A300EC2669 /* Classes */, 130 | 4BA755551D149DD9007B06A5 /* KRAlertController.h */, 131 | 4BA755571D149DD9007B06A5 /* Info.plist */, 132 | ); 133 | path = KRAlertController; 134 | sourceTree = ""; 135 | }; 136 | 4BA755601D149DD9007B06A5 /* KRAlertControllerTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 4BA755611D149DD9007B06A5 /* KRAlertControllerTests.swift */, 140 | 4BA755631D149DD9007B06A5 /* Info.plist */, 141 | ); 142 | path = KRAlertControllerTests; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXHeadersBuildPhase section */ 148 | 4BA7554F1D149DD9007B06A5 /* Headers */ = { 149 | isa = PBXHeadersBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 4BA755561D149DD9007B06A5 /* KRAlertController.h in Headers */, 153 | 4BD66EE41D8A97490066BF6F /* KRAlertAction.swift in Headers */, 154 | 4BD66EE51D8A97490066BF6F /* KRAlertController.swift in Headers */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXHeadersBuildPhase section */ 159 | 160 | /* Begin PBXNativeTarget section */ 161 | 4BA755511D149DD9007B06A5 /* KRAlertController */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = 4BA755661D149DD9007B06A5 /* Build configuration list for PBXNativeTarget "KRAlertController" */; 164 | buildPhases = ( 165 | 4BA7554D1D149DD9007B06A5 /* Sources */, 166 | 4BA7554E1D149DD9007B06A5 /* Frameworks */, 167 | 4BA7554F1D149DD9007B06A5 /* Headers */, 168 | 4BA755501D149DD9007B06A5 /* Resources */, 169 | 4B9CDDB21D527CB300C2890F /* Swift Lint */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | ); 175 | name = KRAlertController; 176 | productName = KRAlertController; 177 | productReference = 4BA755521D149DD9007B06A5 /* KRAlertController.framework */; 178 | productType = "com.apple.product-type.framework"; 179 | }; 180 | 4BA7555B1D149DD9007B06A5 /* KRAlertControllerTests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = 4BA755691D149DD9007B06A5 /* Build configuration list for PBXNativeTarget "KRAlertControllerTests" */; 183 | buildPhases = ( 184 | 4BA755581D149DD9007B06A5 /* Sources */, 185 | 4BA755591D149DD9007B06A5 /* Frameworks */, 186 | 4BA7555A1D149DD9007B06A5 /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | 4BA7555F1D149DD9007B06A5 /* PBXTargetDependency */, 192 | ); 193 | name = KRAlertControllerTests; 194 | productName = KRAlertControllerTests; 195 | productReference = 4BA7555C1D149DD9007B06A5 /* KRAlertControllerTests.xctest */; 196 | productType = "com.apple.product-type.bundle.unit-test"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | 4BA755491D149DD9007B06A5 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastSwiftUpdateCheck = 0730; 205 | LastUpgradeCheck = 1000; 206 | ORGANIZATIONNAME = Krimpedance; 207 | TargetAttributes = { 208 | 4BA755511D149DD9007B06A5 = { 209 | CreatedOnToolsVersion = 7.3.1; 210 | LastSwiftMigration = 0800; 211 | ProvisioningStyle = Automatic; 212 | }; 213 | 4BA7555B1D149DD9007B06A5 = { 214 | CreatedOnToolsVersion = 7.3.1; 215 | }; 216 | }; 217 | }; 218 | buildConfigurationList = 4BA7554C1D149DD9007B06A5 /* Build configuration list for PBXProject "KRAlertController" */; 219 | compatibilityVersion = "Xcode 10.0"; 220 | developmentRegion = English; 221 | hasScannedForEncodings = 0; 222 | knownRegions = ( 223 | en, 224 | ); 225 | mainGroup = 4BA755481D149DD9007B06A5; 226 | productRefGroup = 4BA755531D149DD9007B06A5 /* Products */; 227 | projectDirPath = ""; 228 | projectRoot = ""; 229 | targets = ( 230 | 4BA755511D149DD9007B06A5 /* KRAlertController */, 231 | 4BA7555B1D149DD9007B06A5 /* KRAlertControllerTests */, 232 | ); 233 | }; 234 | /* End PBXProject section */ 235 | 236 | /* Begin PBXResourcesBuildPhase section */ 237 | 4BA755501D149DD9007B06A5 /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | 4BA7555A1D149DD9007B06A5 /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXResourcesBuildPhase section */ 252 | 253 | /* Begin PBXShellScriptBuildPhase section */ 254 | 4B9CDDB21D527CB300C2890F /* Swift Lint */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputPaths = ( 260 | ); 261 | name = "Swift Lint"; 262 | outputPaths = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | shellPath = /bin/sh; 266 | shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi"; 267 | }; 268 | /* End PBXShellScriptBuildPhase section */ 269 | 270 | /* Begin PBXSourcesBuildPhase section */ 271 | 4BA7554D1D149DD9007B06A5 /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 4BB4B9561D15A30E004570F1 /* KRAlertAction.swift in Sources */, 276 | 4B53A29A1D1576A300EC2669 /* KRAlertController.swift in Sources */, 277 | 4B7576F41D1C33D3003FF258 /* KRAlertButtonTable.swift in Sources */, 278 | 4BF2395C1D1A428A0076415B /* KRAlertControllerEnumerates.swift in Sources */, 279 | 4B7576F51D1C33D3003FF258 /* KRAlertContentView.swift in Sources */, 280 | 4B7576F31D1C33D3003FF258 /* KRAlertButton.swift in Sources */, 281 | 4BAB3F2A1D1D2C4200949F4F /* KRAlertTextFieldView.swift in Sources */, 282 | 4B5A5EA71D19140B00041FA5 /* KRAlertBaseViewController.swift in Sources */, 283 | 4B53A29C1D1576D600EC2669 /* KRAlertControllerExtensions.swift in Sources */, 284 | 4B7576F81D1C392C003FF258 /* KRAlertIconPath.swift in Sources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | 4BA755581D149DD9007B06A5 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 4BA755621D149DD9007B06A5 /* KRAlertControllerTests.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | /* End PBXSourcesBuildPhase section */ 297 | 298 | /* Begin PBXTargetDependency section */ 299 | 4BA7555F1D149DD9007B06A5 /* PBXTargetDependency */ = { 300 | isa = PBXTargetDependency; 301 | target = 4BA755511D149DD9007B06A5 /* KRAlertController */; 302 | targetProxy = 4BA7555E1D149DD9007B06A5 /* PBXContainerItemProxy */; 303 | }; 304 | /* End PBXTargetDependency section */ 305 | 306 | /* Begin XCBuildConfiguration section */ 307 | 4BA755641D149DD9007B06A5 /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_ANALYZER_NONNULL = YES; 312 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 313 | CLANG_CXX_LIBRARY = "libc++"; 314 | CLANG_ENABLE_MODULES = YES; 315 | CLANG_ENABLE_OBJC_ARC = YES; 316 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_COMMA = YES; 319 | CLANG_WARN_CONSTANT_CONVERSION = YES; 320 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 322 | CLANG_WARN_EMPTY_BODY = YES; 323 | CLANG_WARN_ENUM_CONVERSION = YES; 324 | CLANG_WARN_INFINITE_RECURSION = YES; 325 | CLANG_WARN_INT_CONVERSION = YES; 326 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 328 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 331 | CLANG_WARN_STRICT_PROTOTYPES = YES; 332 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 333 | CLANG_WARN_UNREACHABLE_CODE = YES; 334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 335 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 336 | COPY_PHASE_STRIP = NO; 337 | CURRENT_PROJECT_VERSION = 1; 338 | DEBUG_INFORMATION_FORMAT = dwarf; 339 | ENABLE_STRICT_OBJC_MSGSEND = YES; 340 | ENABLE_TESTABILITY = YES; 341 | GCC_C_LANGUAGE_STANDARD = gnu99; 342 | GCC_DYNAMIC_NO_PIC = NO; 343 | GCC_NO_COMMON_BLOCKS = YES; 344 | GCC_OPTIMIZATION_LEVEL = 0; 345 | GCC_PREPROCESSOR_DEFINITIONS = ( 346 | "DEBUG=1", 347 | "$(inherited)", 348 | ); 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 356 | MTL_ENABLE_DEBUG_INFO = YES; 357 | ONLY_ACTIVE_ARCH = YES; 358 | SDKROOT = iphoneos; 359 | SWIFT_COMPILATION_MODE = singlefile; 360 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 361 | SWIFT_VERSION = 4.2; 362 | TARGETED_DEVICE_FAMILY = "1,2"; 363 | VERSIONING_SYSTEM = "apple-generic"; 364 | VERSION_INFO_PREFIX = ""; 365 | }; 366 | name = Debug; 367 | }; 368 | 4BA755651D149DD9007B06A5 /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ALWAYS_SEARCH_USER_PATHS = NO; 372 | CLANG_ANALYZER_NONNULL = YES; 373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 374 | CLANG_CXX_LIBRARY = "libc++"; 375 | CLANG_ENABLE_MODULES = YES; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_COMMA = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 389 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 392 | CLANG_WARN_STRICT_PROTOTYPES = YES; 393 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | CURRENT_PROJECT_VERSION = 1; 399 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 400 | ENABLE_NS_ASSERTIONS = NO; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | GCC_C_LANGUAGE_STANDARD = gnu99; 403 | GCC_NO_COMMON_BLOCKS = YES; 404 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 405 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 406 | GCC_WARN_UNDECLARED_SELECTOR = YES; 407 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 408 | GCC_WARN_UNUSED_FUNCTION = YES; 409 | GCC_WARN_UNUSED_VARIABLE = YES; 410 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 411 | MTL_ENABLE_DEBUG_INFO = NO; 412 | SDKROOT = iphoneos; 413 | SWIFT_COMPILATION_MODE = wholemodule; 414 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 415 | SWIFT_VERSION = 4.2; 416 | TARGETED_DEVICE_FAMILY = "1,2"; 417 | VALIDATE_PRODUCT = YES; 418 | VERSIONING_SYSTEM = "apple-generic"; 419 | VERSION_INFO_PREFIX = ""; 420 | }; 421 | name = Release; 422 | }; 423 | 4BA755671D149DD9007B06A5 /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 427 | CODE_SIGN_STYLE = Automatic; 428 | DEFINES_MODULE = YES; 429 | DEVELOPMENT_TEAM = ""; 430 | DYLIB_COMPATIBILITY_VERSION = 1; 431 | DYLIB_CURRENT_VERSION = 1; 432 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 433 | INFOPLIST_FILE = KRAlertController/Info.plist; 434 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 435 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 436 | LD_RUNPATH_SEARCH_PATHS = ( 437 | "$(inherited)", 438 | "@executable_path/Frameworks", 439 | "@loader_path/Frameworks", 440 | ); 441 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertController; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | PROVISIONING_PROFILE_SPECIFIER = ""; 444 | SKIP_INSTALL = YES; 445 | SWIFT_VERSION = 4.2; 446 | }; 447 | name = Debug; 448 | }; 449 | 4BA755681D149DD9007B06A5 /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 453 | CODE_SIGN_STYLE = Automatic; 454 | DEFINES_MODULE = YES; 455 | DEVELOPMENT_TEAM = ""; 456 | DYLIB_COMPATIBILITY_VERSION = 1; 457 | DYLIB_CURRENT_VERSION = 1; 458 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 459 | INFOPLIST_FILE = KRAlertController/Info.plist; 460 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 461 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 462 | LD_RUNPATH_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "@executable_path/Frameworks", 465 | "@loader_path/Frameworks", 466 | ); 467 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertController; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | PROVISIONING_PROFILE_SPECIFIER = ""; 470 | SKIP_INSTALL = YES; 471 | SWIFT_VERSION = 4.2; 472 | }; 473 | name = Release; 474 | }; 475 | 4BA7556A1D149DD9007B06A5 /* Debug */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | INFOPLIST_FILE = KRAlertControllerTests/Info.plist; 479 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 480 | LD_RUNPATH_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "@executable_path/Frameworks", 483 | "@loader_path/Frameworks", 484 | ); 485 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertControllerTests; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_VERSION = 4.2; 488 | }; 489 | name = Debug; 490 | }; 491 | 4BA7556B1D149DD9007B06A5 /* Release */ = { 492 | isa = XCBuildConfiguration; 493 | buildSettings = { 494 | INFOPLIST_FILE = KRAlertControllerTests/Info.plist; 495 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 496 | LD_RUNPATH_SEARCH_PATHS = ( 497 | "$(inherited)", 498 | "@executable_path/Frameworks", 499 | "@loader_path/Frameworks", 500 | ); 501 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRAlertControllerTests; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | SWIFT_VERSION = 4.2; 504 | }; 505 | name = Release; 506 | }; 507 | /* End XCBuildConfiguration section */ 508 | 509 | /* Begin XCConfigurationList section */ 510 | 4BA7554C1D149DD9007B06A5 /* Build configuration list for PBXProject "KRAlertController" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | 4BA755641D149DD9007B06A5 /* Debug */, 514 | 4BA755651D149DD9007B06A5 /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | defaultConfigurationName = Release; 518 | }; 519 | 4BA755661D149DD9007B06A5 /* Build configuration list for PBXNativeTarget "KRAlertController" */ = { 520 | isa = XCConfigurationList; 521 | buildConfigurations = ( 522 | 4BA755671D149DD9007B06A5 /* Debug */, 523 | 4BA755681D149DD9007B06A5 /* Release */, 524 | ); 525 | defaultConfigurationIsVisible = 0; 526 | defaultConfigurationName = Release; 527 | }; 528 | 4BA755691D149DD9007B06A5 /* Build configuration list for PBXNativeTarget "KRAlertControllerTests" */ = { 529 | isa = XCConfigurationList; 530 | buildConfigurations = ( 531 | 4BA7556A1D149DD9007B06A5 /* Debug */, 532 | 4BA7556B1D149DD9007B06A5 /* Release */, 533 | ); 534 | defaultConfigurationIsVisible = 0; 535 | defaultConfigurationName = Release; 536 | }; 537 | /* End XCConfigurationList section */ 538 | }; 539 | rootObject = 4BA755491D149DD9007B06A5 /* Project object */; 540 | } 541 | -------------------------------------------------------------------------------- /DEMO/KRAlertControllerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 44 | 68 | 92 | 116 | 140 | 164 | 188 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | --------------------------------------------------------------------------------