├── .swift-version ├── Demo ├── Images │ └── Demo.gif ├── KSGuideControllerDemo │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── arrow.imageset │ │ │ ├── arrow@3x.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── AppDelegate.swift │ └── ViewController.swift └── KSGuideControllerDemo.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── KSGuideController ├── Resources │ └── guide_arrow@3x.png ├── Extensions.swift ├── KSGuideItem.swift ├── KSGuideDataManager.swift └── KSGuideController.swift ├── LICENSE ├── .gitignore ├── README.md └── KSGuideController.podspec /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /Demo/Images/Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skx926/KSGuideController/HEAD/Demo/Images/Demo.gif -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /KSGuideController/Resources/guide_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skx926/KSGuideController/HEAD/KSGuideController/Resources/guide_arrow@3x.png -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Assets.xcassets/arrow.imageset/arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skx926/KSGuideController/HEAD/Demo/KSGuideControllerDemo/Assets.xcassets/arrow.imageset/arrow@3x.png -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Assets.xcassets/arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "arrow@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KSGuideController/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // KSGuideController 4 | // 5 | // Created by Kyle Sun on 2017/5/8. 6 | // Copyright © 2017年 Kyle Sun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | extension String { 13 | func ks_size(of font: UIFont, maxWidth: CGFloat) -> CGSize { 14 | let s = self as NSString 15 | let size = s.boundingRect(with: CGSize(width: maxWidth, height: .infinity), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine, .usesFontLeading], attributes: [NSAttributedStringKey.font: font], context: nil).size 16 | return size; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KSGuideController/KSGuideItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KSGuideItem.swift 3 | // KSGuideViewControllerDemo 4 | // 5 | // Created by Kyle Sun on 2017/5/8. 6 | // Copyright © 2017年 Kyle Sun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc public class KSGuideItem: NSObject { 12 | @objc public var sourceView: UIView? 13 | @objc public var rect: CGRect = .zero 14 | // arrow image for this item 15 | @objc public var arrowImage: UIImage? 16 | @objc public var text: String! 17 | 18 | @objc public init(sourceView: UIView, arrowImage: UIImage? = nil, text: String) { 19 | self.sourceView = sourceView 20 | self.arrowImage = arrowImage 21 | self.text = text 22 | } 23 | 24 | @objc public init(rect: CGRect, arrowImage: UIImage? = nil, text: String) { 25 | self.rect = rect 26 | self.arrowImage = arrowImage 27 | self.text = text 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Kyle Sun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /KSGuideController/KSGuideDataManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KSGuideDataManager.swift 3 | // KSGuideController 4 | // 5 | // Created by Kyle Sun on 2017/5/15. 6 | // Copyright © 2017年 Kyle Sun. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | @objc public class KSGuideDataManager: NSObject { 12 | 13 | static let userDefaults = UserDefaults.standard 14 | static let dataKey = "KSGuideDataKey" 15 | 16 | @objc public static func reset(for key: String) { 17 | if var data = userDefaults.object(forKey: dataKey) as? [String: Bool] { 18 | data.removeValue(forKey: key) 19 | userDefaults.set(data, forKey: dataKey) 20 | } 21 | } 22 | 23 | @objc public static func resetAll() { 24 | userDefaults.set(nil, forKey: dataKey) 25 | } 26 | 27 | static func shouldShowGuide(with key: String) -> Bool { 28 | if var data = userDefaults.object(forKey: dataKey) as? [String: Bool] { 29 | if let _ = data[key] { 30 | return false 31 | } 32 | data[key] = true 33 | userDefaults.set(data, forKey: dataKey) 34 | return true 35 | } 36 | let data = [key: true] 37 | userDefaults.set(data, forKey: dataKey) 38 | return true 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/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 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KSGuideController 4 | // 5 | // Created by Kyle Sun on 2017/5/8. 6 | // Copyright © 2017年 Kyle Sun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | KSGuideController 2 | ============== 3 | [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/skx926/KSGuideController/master/LICENSE)  4 | [![CocoaPods](http://img.shields.io/cocoapods/v/KSGuideController.svg?style=flat)](http://cocoapods.org/?q=KSGuideController)  5 | [![CocoaPods](http://img.shields.io/cocoapods/p/KSGuideController.svg?style=flat)](http://cocoapods.org/?q=KSGuideController)  6 | [![Support](https://img.shields.io/badge/support-iOS%208.0%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)  7 | 8 | ### A beautiful animated novice guide controller written in Swift. 9 | 10 | ![Demo~](https://raw.github.com/skx926/KSGuideController/master/Demo/Images/Demo.gif) 11 | 12 | Features 13 | ============== 14 | - Animated page transition. 15 | - A batch of properties for customization. 16 | - Cache support. 17 | 18 | Usage 19 | ============== 20 | ### Swift 21 | ```swift 22 | import KSGuideController 23 | 24 | var items = [KSGuideItem]() 25 | for button in buttons { 26 | let n = Int(arc4random()) % string.count 27 | let index = string.index(string.startIndex, offsetBy: Int(n)) 28 | let text = string[.. "MIT", :file => "FILE_LICENSE" } 43 | 44 | 45 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 46 | # 47 | # Specify the authors of the library, with email addresses. Email addresses 48 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 49 | # accepts just a name if you'd rather not provide an email address. 50 | # 51 | # Specify a social_media_url where others can refer to, for example a twitter 52 | # profile URL. 53 | # 54 | 55 | s.author = { "Kyle Sun" => "skx926@gmail.com" } 56 | # Or just: s.author = "Kyle Sun" 57 | # s.authors = { "Kyle Sun" => "skx926@gmail.com" } 58 | s.social_media_url = "https://twitter.com/skx926" 59 | 60 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 61 | # 62 | # If this Pod runs only on iOS or OS X, then specify the platform and 63 | # the deployment target. You can optionally include the target after the platform. 64 | # 65 | 66 | # s.platform = :ios 67 | s.platform = :ios, "8.0" 68 | 69 | # When using multiple platforms 70 | # s.ios.deployment_target = "5.0" 71 | # s.osx.deployment_target = "10.7" 72 | # s.watchos.deployment_target = "2.0" 73 | # s.tvos.deployment_target = "9.0" 74 | 75 | 76 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 77 | # 78 | # Specify the location from where the source should be retrieved. 79 | # Supports git, hg, bzr, svn and HTTP. 80 | # 81 | 82 | s.source = { :git => "https://github.com/skx926/KSGuideController.git", :tag => "#{s.version}" } 83 | 84 | 85 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 86 | # 87 | # CocoaPods is smart about how it includes source code. For source files 88 | # giving a folder will include any swift, h, m, mm, c & cpp files. 89 | # For header files it will include any header in the folder. 90 | # Not including the public_header_files will make all headers public. 91 | # 92 | 93 | s.source_files = "KSGuideController", "KSGuideController/**/*.{swift}" 94 | # s.exclude_files = "Classes/Exclude" 95 | 96 | # s.public_header_files = "KSGuideController/**/*.h" 97 | 98 | 99 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 100 | # 101 | # A list of resources included with the Pod. These are copied into the 102 | # target bundle with a build phase script. Anything else will be cleaned. 103 | # You can preserve files from being cleaned, please don't preserve 104 | # non-essential files like tests, examples and documentation. 105 | # 106 | 107 | # s.resource = "icon.png" 108 | s.resources = "KSGuideController/Resources/*.png" 109 | 110 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 111 | 112 | 113 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 114 | # 115 | # Link your library with frameworks, or libraries. Libraries do not include 116 | # the lib prefix of their name. 117 | # 118 | 119 | s.framework = "UIKit" 120 | # s.frameworks = "SomeFramework", "AnotherFramework" 121 | 122 | # s.library = "iconv" 123 | # s.libraries = "iconv", "xml2" 124 | 125 | 126 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 127 | # 128 | # If your library depends on compiler flags you can set them in the xcconfig hash 129 | # where they will only apply to your library. If you depend on other Podspecs 130 | # you can include multiple dependencies to ensure it works. 131 | 132 | # s.requires_arc = true 133 | 134 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 135 | # s.dependency "YYWebImage", "~> 1.0.5" 136 | 137 | end 138 | -------------------------------------------------------------------------------- /KSGuideController/KSGuideController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KSGuideViewController.swift 3 | // KSGuideViewControllerDemo 4 | // 5 | // Created by Kyle Sun on 2017/5/8. 6 | // Copyright © 2017年 Kyle Sun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc public class KSGuideController: UIViewController { 12 | 13 | enum Region { 14 | case upperLeft 15 | case upperRight 16 | case lowerLeft 17 | case lowerRight 18 | } 19 | 20 | public typealias CompletionBlock = (() -> Void) 21 | public typealias IndexChangeBlock = ((_ index: Int, _ item: KSGuideItem) -> Void) 22 | 23 | private var items = [KSGuideItem]() 24 | @objc public var currentIndex: Int = -1 { 25 | didSet { 26 | self.indexWillChangeBlock?(currentIndex, self.currentItem) 27 | configViews() 28 | self.indexDidChangeBlock?(currentIndex, self.currentItem) 29 | } 30 | } 31 | private var currentItem: KSGuideItem { 32 | get { 33 | return items[currentIndex] 34 | } 35 | } 36 | private let arrowImageView = UIImageView() 37 | private let textLabel = UILabel() 38 | private let maskLayer = CAShapeLayer() 39 | private var completion: CompletionBlock? 40 | private var indexWillChangeBlock: IndexChangeBlock? 41 | private var indexDidChangeBlock: IndexChangeBlock? 42 | private var guideKey: String? 43 | 44 | @objc public var maskCornerRadius: CGFloat = 5 45 | @objc public var backgroundAlpha: CGFloat = 0.7 46 | @objc public var spacing: CGFloat = 20 47 | @objc public var padding: CGFloat = 50 48 | @objc public var maskInsets = UIEdgeInsets(top: -8, left: -8, bottom: -8, right: -8) 49 | @objc public var font = UIFont.systemFont(ofSize: 14) 50 | @objc public var textColor = UIColor.white 51 | @objc public var arrowColor = UIColor.white 52 | // Global arrow image for all items 53 | @objc public var arrowImage: UIImage? 54 | @objc public var animationDuration = 0.3 55 | @objc public var animatedMask = true 56 | @objc public var animatedText = true 57 | @objc public var animatedArrow = true 58 | 59 | @objc public var statusBarHidden = false 60 | 61 | private var maskCenter: CGPoint { 62 | get { 63 | return CGPoint(x: hollowFrame.midX, y: hollowFrame.midY) 64 | } 65 | } 66 | 67 | private var region: Region { 68 | get { 69 | let center = maskCenter 70 | let bounds = view.bounds 71 | if center.x <= bounds.midX && center.y <= bounds.midY { 72 | return .upperLeft 73 | } else if center.x > bounds.midX && center.y <= bounds.midY { 74 | return .upperRight 75 | } else if center.x <= bounds.midX && center.y > bounds.midY { 76 | return .lowerLeft 77 | } else { 78 | return .lowerRight 79 | } 80 | } 81 | } 82 | 83 | private var hollowFrame: CGRect { 84 | get { 85 | var rect: CGRect = .zero 86 | if let sourceView = currentItem.sourceView { 87 | let systemVersion = (UIDevice.current.systemVersion as NSString).floatValue 88 | if systemVersion >= 8.0 && systemVersion < 9.0 { 89 | // Unwrap the superView to ensure that we call `convert(_ rect: CGRect, from coordinateSpace: UICoordinateSpace) -> CGRect` 90 | // instead of `convert(_ rect: CGRect, from view: UIView?) -> CGRect` 91 | if let superView = sourceView.superview { 92 | rect = view.convert(sourceView.frame, from: superView) 93 | } else { 94 | assertionFailure("sourceView must have a superView!") 95 | } 96 | } else { 97 | rect = view.convert(sourceView.frame, from: sourceView.superview) 98 | } 99 | } else { 100 | rect = currentItem.rect 101 | } 102 | rect.origin.x += maskInsets.left 103 | rect.origin.y += maskInsets.top 104 | rect.size.width -= maskInsets.right + maskInsets.left 105 | rect.size.height -= maskInsets.bottom + maskInsets.top 106 | return rect 107 | } 108 | } 109 | 110 | 111 | // Give a nil key to ignore the cache logic. 112 | @objc public convenience init(item: KSGuideItem, key: String?) { 113 | self.init(items: [item], key: key) 114 | } 115 | 116 | // Give a nil key to ignore the cache logic. 117 | @objc public init(items: [KSGuideItem], key: String?) { 118 | super.init(nibName: nil, bundle: nil) 119 | modalPresentationStyle = .custom 120 | modalTransitionStyle = .crossDissolve 121 | self.items.append(contentsOf: items) 122 | self.guideKey = key 123 | } 124 | 125 | @objc public func show(from vc: UIViewController, completion:CompletionBlock?) { 126 | self.completion = completion 127 | if let key = guideKey { 128 | if KSGuideDataManager.shouldShowGuide(with: key) { 129 | vc.present(self, animated: true, completion: nil) 130 | } 131 | } else { 132 | vc.present(self, animated: true, completion: nil) 133 | } 134 | } 135 | 136 | @objc public func setIndexWillChangeBlock(_ block: IndexChangeBlock?) { 137 | indexWillChangeBlock = block 138 | } 139 | 140 | @objc public func setIndexDidChangeBlock(_ block: IndexChangeBlock?) { 141 | indexDidChangeBlock = block; 142 | } 143 | 144 | @objc required public init?(coder aDecoder: NSCoder) { 145 | super.init(coder: aDecoder) 146 | } 147 | 148 | @objc override public func viewDidLoad() { 149 | super.viewDidLoad() 150 | 151 | currentIndex = 0 152 | } 153 | 154 | @objc public override var prefersStatusBarHidden: Bool { 155 | return statusBarHidden 156 | } 157 | 158 | @objc public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { 159 | coordinator.animate(alongsideTransition: { (ctx) in 160 | self.configMask() 161 | self.configViewFrames() 162 | }, completion: nil) 163 | } 164 | 165 | @objc override public func didReceiveMemoryWarning() { 166 | super.didReceiveMemoryWarning() 167 | // Dispose of any resources that can be recreated. 168 | } 169 | 170 | private func configViews() { 171 | view.backgroundColor = UIColor(white: 0, alpha: backgroundAlpha) 172 | 173 | if let image = currentItem.arrowImage { 174 | arrowImageView.image = image 175 | } else if let image = arrowImage { 176 | arrowImageView.image = image 177 | } else { 178 | arrowImageView.image = UIImage(named: "guide_arrow", in: Bundle(for: KSGuideController.self), compatibleWith: nil) 179 | } 180 | arrowImageView.image = arrowImageView.image?.withRenderingMode(UIImageRenderingMode.alwaysTemplate) 181 | arrowImageView.tintColor = arrowColor 182 | view.addSubview(arrowImageView) 183 | 184 | textLabel.textColor = textColor 185 | textLabel.font = font 186 | textLabel.textAlignment = .left 187 | textLabel.text = currentItem.text 188 | textLabel.numberOfLines = 0 189 | view.addSubview(textLabel) 190 | 191 | configMask() 192 | configViewFrames() 193 | } 194 | 195 | private func configMask() { 196 | let fromPath = maskLayer.path 197 | 198 | maskLayer.fillColor = UIColor.black.cgColor 199 | var radius = maskCornerRadius 200 | let frame = hollowFrame 201 | radius = min(radius, min(frame.width / 2.0, frame.height / 2.0)) 202 | let highlightedPath = UIBezierPath(roundedRect: hollowFrame, cornerRadius: radius) 203 | let toPath = UIBezierPath(rect: view.bounds) 204 | toPath.append(highlightedPath) 205 | maskLayer.path = toPath.cgPath 206 | maskLayer.fillRule = kCAFillRuleEvenOdd 207 | view.layer.mask = maskLayer 208 | 209 | if animatedMask { 210 | let animation = CABasicAnimation(keyPath: "path") 211 | animation.duration = animationDuration 212 | animation.fromValue = fromPath 213 | animation.toValue = toPath 214 | maskLayer.add(animation, forKey: nil) 215 | } 216 | } 217 | 218 | private func configViewFrames() { 219 | maskLayer.frame = view.bounds 220 | 221 | var textRect: CGRect! 222 | var arrowRect: CGRect! 223 | var transform: CGAffineTransform = .identity 224 | let imageSize = arrowImageView.image!.size 225 | let maxWidth = view.frame.size.width - padding * 2 226 | let size = currentItem.text.ks_size(of: font, maxWidth: maxWidth) 227 | let maxX = padding + maxWidth - size.width 228 | switch region { 229 | 230 | case .upperLeft: 231 | transform = CGAffineTransform(scaleX: -1, y: 1) 232 | arrowRect = CGRect(x: hollowFrame.midX - imageSize.width / 2, 233 | y: hollowFrame.maxY + spacing, 234 | width: imageSize.width, 235 | height: imageSize.height) 236 | let x: CGFloat = max(padding, min(maxX, arrowRect.maxX - size.width / 2)) 237 | textRect = CGRect(x: x, 238 | y: arrowRect.maxY + spacing, 239 | width: size.width, 240 | height: size.height) 241 | 242 | case .upperRight: 243 | arrowRect = CGRect(x: hollowFrame.midX - imageSize.width / 2, 244 | y: hollowFrame.maxY + spacing, 245 | width: imageSize.width, 246 | height: imageSize.height) 247 | let x: CGFloat = max(padding, min(maxX, arrowRect.minX - size.width / 2)) 248 | textRect = CGRect(x: x, 249 | y: arrowRect.maxY + spacing, 250 | width: size.width, 251 | height: size.height) 252 | 253 | case .lowerLeft: 254 | transform = CGAffineTransform(scaleX: -1, y: -1) 255 | arrowRect = CGRect(x: hollowFrame.midX - imageSize.width / 2, 256 | y: hollowFrame.minY - spacing - imageSize.height, 257 | width: imageSize.width, 258 | height: imageSize.height) 259 | let x: CGFloat = max(padding, min(maxX, arrowRect.maxX - size.width / 2)) 260 | textRect = CGRect(x: x, 261 | y: arrowRect.minY - spacing - size.height, 262 | width: size.width, 263 | height: size.height) 264 | 265 | case .lowerRight: 266 | transform = CGAffineTransform(scaleX: 1, y: -1) 267 | arrowRect = CGRect(x: hollowFrame.midX - imageSize.width / 2, 268 | y: hollowFrame.minY - spacing - imageSize.height, 269 | width: imageSize.width, 270 | height: imageSize.height) 271 | let x: CGFloat = max(padding, min(maxX, arrowRect.minX - size.width / 2)) 272 | textRect = CGRect(x: x, 273 | y: arrowRect.minY - spacing - size.height, 274 | width: size.width, 275 | height: size.height) 276 | } 277 | if animatedArrow && animatedText { 278 | UIView.animate(withDuration: animationDuration, animations: { 279 | self.arrowImageView.transform = transform 280 | self.arrowImageView.frame = arrowRect 281 | self.textLabel.frame = textRect 282 | }, completion: nil) 283 | return 284 | } 285 | if animatedArrow { 286 | UIView.animate(withDuration: animationDuration, animations: { 287 | self.arrowImageView.transform = transform 288 | self.arrowImageView.frame = arrowRect 289 | }, completion: nil) 290 | self.textLabel.frame = textRect 291 | return 292 | } 293 | if animatedText { 294 | UIView.animate(withDuration: animationDuration, animations: { 295 | self.textLabel.frame = textRect 296 | }, completion: nil) 297 | self.arrowImageView.transform = transform 298 | self.arrowImageView.frame = arrowRect 299 | return 300 | } 301 | arrowImageView.transform = transform 302 | arrowImageView.frame = arrowRect 303 | textLabel.frame = textRect 304 | } 305 | 306 | @objc public override func touchesBegan(_ touches: Set, with event: UIEvent?) { 307 | if currentIndex < items.count - 1 { 308 | currentIndex += 1 309 | } else { 310 | dismiss(animated: true, completion: completion) 311 | } 312 | } 313 | } 314 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 33 | 43 | 53 | 63 | 73 | 83 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Demo/KSGuideControllerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 272B4D001EC953C7007AC668 /* KSGuideDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272B4CFF1EC953C6007AC668 /* KSGuideDataManager.swift */; }; 11 | 2739BB9C1EC05D22002287EA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2739BB9B1EC05D22002287EA /* AppDelegate.swift */; }; 12 | 2739BB9E1EC05D22002287EA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2739BB9D1EC05D22002287EA /* ViewController.swift */; }; 13 | 2739BBA11EC05D22002287EA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2739BB9F1EC05D22002287EA /* Main.storyboard */; }; 14 | 2739BBA31EC05D22002287EA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2739BBA21EC05D22002287EA /* Assets.xcassets */; }; 15 | 2739BBA61EC05D22002287EA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2739BBA41EC05D22002287EA /* LaunchScreen.storyboard */; }; 16 | 2739BBB21EC05D4A002287EA /* KSGuideController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2739BBAF1EC05D49002287EA /* KSGuideController.swift */; }; 17 | 2739BBB31EC05D4A002287EA /* KSGuideItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2739BBB01EC05D4A002287EA /* KSGuideItem.swift */; }; 18 | 2739BBB51EC06D8F002287EA /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2739BBB41EC06D8F002287EA /* Extensions.swift */; }; 19 | F7606FBB1EC888CD00F6419F /* guide_arrow@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F7606FBA1EC888CD00F6419F /* guide_arrow@3x.png */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 272B4CFF1EC953C6007AC668 /* KSGuideDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KSGuideDataManager.swift; sourceTree = ""; }; 24 | 2739BB981EC05D22002287EA /* KSGuideControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KSGuideControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 2739BB9B1EC05D22002287EA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 2739BB9D1EC05D22002287EA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 2739BBA01EC05D22002287EA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 2739BBA21EC05D22002287EA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 2739BBA51EC05D22002287EA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 2739BBA71EC05D22002287EA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 2739BBAF1EC05D49002287EA /* KSGuideController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KSGuideController.swift; sourceTree = ""; }; 32 | 2739BBB01EC05D4A002287EA /* KSGuideItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KSGuideItem.swift; sourceTree = ""; }; 33 | 2739BBB41EC06D8F002287EA /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 34 | F7606FBA1EC888CD00F6419F /* guide_arrow@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_arrow@3x.png"; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 2739BB951EC05D22002287EA /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 2739BB8F1EC05D22002287EA = { 49 | isa = PBXGroup; 50 | children = ( 51 | 2739BB9A1EC05D22002287EA /* KSGuideControllerDemo */, 52 | 2739BB991EC05D22002287EA /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | 2739BB991EC05D22002287EA /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 2739BB981EC05D22002287EA /* KSGuideControllerDemo.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | 2739BB9A1EC05D22002287EA /* KSGuideControllerDemo */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 2739BBAD1EC05D49002287EA /* KSGuideController */, 68 | 2739BB9B1EC05D22002287EA /* AppDelegate.swift */, 69 | 2739BB9D1EC05D22002287EA /* ViewController.swift */, 70 | 2739BB9F1EC05D22002287EA /* Main.storyboard */, 71 | 2739BBA21EC05D22002287EA /* Assets.xcassets */, 72 | 2739BBA41EC05D22002287EA /* LaunchScreen.storyboard */, 73 | 2739BBA71EC05D22002287EA /* Info.plist */, 74 | ); 75 | path = KSGuideControllerDemo; 76 | sourceTree = ""; 77 | }; 78 | 2739BBAD1EC05D49002287EA /* KSGuideController */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | F7606FB91EC888CD00F6419F /* Resources */, 82 | 2739BBAF1EC05D49002287EA /* KSGuideController.swift */, 83 | 272B4CFF1EC953C6007AC668 /* KSGuideDataManager.swift */, 84 | 2739BBB01EC05D4A002287EA /* KSGuideItem.swift */, 85 | 2739BBB41EC06D8F002287EA /* Extensions.swift */, 86 | ); 87 | name = KSGuideController; 88 | path = ../../KSGuideController; 89 | sourceTree = ""; 90 | }; 91 | F7606FB91EC888CD00F6419F /* Resources */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | F7606FBA1EC888CD00F6419F /* guide_arrow@3x.png */, 95 | ); 96 | path = Resources; 97 | sourceTree = ""; 98 | }; 99 | /* End PBXGroup section */ 100 | 101 | /* Begin PBXNativeTarget section */ 102 | 2739BB971EC05D22002287EA /* KSGuideControllerDemo */ = { 103 | isa = PBXNativeTarget; 104 | buildConfigurationList = 2739BBAA1EC05D22002287EA /* Build configuration list for PBXNativeTarget "KSGuideControllerDemo" */; 105 | buildPhases = ( 106 | 2739BB941EC05D22002287EA /* Sources */, 107 | 2739BB951EC05D22002287EA /* Frameworks */, 108 | 2739BB961EC05D22002287EA /* Resources */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = KSGuideControllerDemo; 115 | productName = KSGuideControllerDemo; 116 | productReference = 2739BB981EC05D22002287EA /* KSGuideControllerDemo.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | 2739BB901EC05D22002287EA /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | LastSwiftUpdateCheck = 0830; 126 | LastUpgradeCheck = 0910; 127 | ORGANIZATIONNAME = "Kyle Sun"; 128 | TargetAttributes = { 129 | 2739BB971EC05D22002287EA = { 130 | CreatedOnToolsVersion = 8.3; 131 | DevelopmentTeam = E38TCMJ79F; 132 | ProvisioningStyle = Automatic; 133 | }; 134 | }; 135 | }; 136 | buildConfigurationList = 2739BB931EC05D22002287EA /* Build configuration list for PBXProject "KSGuideControllerDemo" */; 137 | compatibilityVersion = "Xcode 3.2"; 138 | developmentRegion = English; 139 | hasScannedForEncodings = 0; 140 | knownRegions = ( 141 | en, 142 | Base, 143 | ); 144 | mainGroup = 2739BB8F1EC05D22002287EA; 145 | productRefGroup = 2739BB991EC05D22002287EA /* Products */; 146 | projectDirPath = ""; 147 | projectRoot = ""; 148 | targets = ( 149 | 2739BB971EC05D22002287EA /* KSGuideControllerDemo */, 150 | ); 151 | }; 152 | /* End PBXProject section */ 153 | 154 | /* Begin PBXResourcesBuildPhase section */ 155 | 2739BB961EC05D22002287EA /* Resources */ = { 156 | isa = PBXResourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | F7606FBB1EC888CD00F6419F /* guide_arrow@3x.png in Resources */, 160 | 2739BBA61EC05D22002287EA /* LaunchScreen.storyboard in Resources */, 161 | 2739BBA31EC05D22002287EA /* Assets.xcassets in Resources */, 162 | 2739BBA11EC05D22002287EA /* Main.storyboard in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXSourcesBuildPhase section */ 169 | 2739BB941EC05D22002287EA /* Sources */ = { 170 | isa = PBXSourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 272B4D001EC953C7007AC668 /* KSGuideDataManager.swift in Sources */, 174 | 2739BBB51EC06D8F002287EA /* Extensions.swift in Sources */, 175 | 2739BB9E1EC05D22002287EA /* ViewController.swift in Sources */, 176 | 2739BBB21EC05D4A002287EA /* KSGuideController.swift in Sources */, 177 | 2739BB9C1EC05D22002287EA /* AppDelegate.swift in Sources */, 178 | 2739BBB31EC05D4A002287EA /* KSGuideItem.swift in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin PBXVariantGroup section */ 185 | 2739BB9F1EC05D22002287EA /* Main.storyboard */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | 2739BBA01EC05D22002287EA /* Base */, 189 | ); 190 | name = Main.storyboard; 191 | sourceTree = ""; 192 | }; 193 | 2739BBA41EC05D22002287EA /* LaunchScreen.storyboard */ = { 194 | isa = PBXVariantGroup; 195 | children = ( 196 | 2739BBA51EC05D22002287EA /* Base */, 197 | ); 198 | name = LaunchScreen.storyboard; 199 | sourceTree = ""; 200 | }; 201 | /* End PBXVariantGroup section */ 202 | 203 | /* Begin XCBuildConfiguration section */ 204 | 2739BBA81EC05D22002287EA /* Debug */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | ALWAYS_SEARCH_USER_PATHS = NO; 208 | CLANG_ANALYZER_NONNULL = YES; 209 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_COMMA = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 220 | CLANG_WARN_EMPTY_BODY = YES; 221 | CLANG_WARN_ENUM_CONVERSION = YES; 222 | CLANG_WARN_INFINITE_RECURSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 225 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 226 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 227 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 228 | CLANG_WARN_STRICT_PROTOTYPES = YES; 229 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 230 | CLANG_WARN_UNREACHABLE_CODE = YES; 231 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 232 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 233 | COPY_PHASE_STRIP = NO; 234 | DEBUG_INFORMATION_FORMAT = dwarf; 235 | ENABLE_STRICT_OBJC_MSGSEND = YES; 236 | ENABLE_TESTABILITY = YES; 237 | GCC_C_LANGUAGE_STANDARD = gnu99; 238 | GCC_DYNAMIC_NO_PIC = NO; 239 | GCC_NO_COMMON_BLOCKS = YES; 240 | GCC_OPTIMIZATION_LEVEL = 0; 241 | GCC_PREPROCESSOR_DEFINITIONS = ( 242 | "DEBUG=1", 243 | "$(inherited)", 244 | ); 245 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 246 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 247 | GCC_WARN_UNDECLARED_SELECTOR = YES; 248 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 249 | GCC_WARN_UNUSED_FUNCTION = YES; 250 | GCC_WARN_UNUSED_VARIABLE = YES; 251 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 252 | MTL_ENABLE_DEBUG_INFO = YES; 253 | ONLY_ACTIVE_ARCH = YES; 254 | SDKROOT = iphoneos; 255 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 256 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 257 | }; 258 | name = Debug; 259 | }; 260 | 2739BBA91EC05D22002287EA /* Release */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | ALWAYS_SEARCH_USER_PATHS = NO; 264 | CLANG_ANALYZER_NONNULL = YES; 265 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 276 | CLANG_WARN_EMPTY_BODY = YES; 277 | CLANG_WARN_ENUM_CONVERSION = YES; 278 | CLANG_WARN_INFINITE_RECURSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 282 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 283 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 284 | CLANG_WARN_STRICT_PROTOTYPES = YES; 285 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 286 | CLANG_WARN_UNREACHABLE_CODE = YES; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 289 | COPY_PHASE_STRIP = NO; 290 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 291 | ENABLE_NS_ASSERTIONS = NO; 292 | ENABLE_STRICT_OBJC_MSGSEND = YES; 293 | GCC_C_LANGUAGE_STANDARD = gnu99; 294 | GCC_NO_COMMON_BLOCKS = YES; 295 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 297 | GCC_WARN_UNDECLARED_SELECTOR = YES; 298 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 299 | GCC_WARN_UNUSED_FUNCTION = YES; 300 | GCC_WARN_UNUSED_VARIABLE = YES; 301 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 302 | MTL_ENABLE_DEBUG_INFO = NO; 303 | SDKROOT = iphoneos; 304 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 305 | VALIDATE_PRODUCT = YES; 306 | }; 307 | name = Release; 308 | }; 309 | 2739BBAB1EC05D22002287EA /* Debug */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | DEVELOPMENT_TEAM = E38TCMJ79F; 314 | INFOPLIST_FILE = KSGuideControllerDemo/Info.plist; 315 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 316 | PRODUCT_BUNDLE_IDENTIFIER = com.skx926.KSGuideControllerDemo; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 4.0; 319 | }; 320 | name = Debug; 321 | }; 322 | 2739BBAC1EC05D22002287EA /* Release */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 326 | DEVELOPMENT_TEAM = E38TCMJ79F; 327 | INFOPLIST_FILE = KSGuideControllerDemo/Info.plist; 328 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 329 | PRODUCT_BUNDLE_IDENTIFIER = com.skx926.KSGuideControllerDemo; 330 | PRODUCT_NAME = "$(TARGET_NAME)"; 331 | SWIFT_VERSION = 4.0; 332 | }; 333 | name = Release; 334 | }; 335 | /* End XCBuildConfiguration section */ 336 | 337 | /* Begin XCConfigurationList section */ 338 | 2739BB931EC05D22002287EA /* Build configuration list for PBXProject "KSGuideControllerDemo" */ = { 339 | isa = XCConfigurationList; 340 | buildConfigurations = ( 341 | 2739BBA81EC05D22002287EA /* Debug */, 342 | 2739BBA91EC05D22002287EA /* Release */, 343 | ); 344 | defaultConfigurationIsVisible = 0; 345 | defaultConfigurationName = Release; 346 | }; 347 | 2739BBAA1EC05D22002287EA /* Build configuration list for PBXNativeTarget "KSGuideControllerDemo" */ = { 348 | isa = XCConfigurationList; 349 | buildConfigurations = ( 350 | 2739BBAB1EC05D22002287EA /* Debug */, 351 | 2739BBAC1EC05D22002287EA /* Release */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Release; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = 2739BB901EC05D22002287EA /* Project object */; 359 | } 360 | --------------------------------------------------------------------------------