├── .gitattributes ├── images └── demonstration.gif ├── EWDatePicker ├── Assets.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── CommonHelper.swift ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── AppDelegate.swift ├── ViewController.swift ├── EWDataPickerPresentAnimated.swift └── EWDatePickerViewController.swift ├── EWDatePicker.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── project.pbxproj ├── .swiftlint.yml ├── README.md ├── EWDatePickerTests ├── Info.plist └── EWDatePickerTests.swift ├── EWDatePickerUITests ├── Info.plist └── EWDatePickerUITests.swift └── .gitignore /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /images/demonstration.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangLiquan/EWDatePicker/HEAD/images/demonstration.gif -------------------------------------------------------------------------------- /EWDatePicker/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EWDatePicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: # 禁用指定的规则 2 | - colon 3 | - comma 4 | - control_statement 5 | - line_length 6 | - identifier_name 7 | - multiple_closures_with_trailing_closure 8 | opt_in_rules: # 启用指定的规则 9 | - empty_count 10 | - missing_docs 11 | # 可以通过执行如下指令来查找所有可用的规则: 12 | # swiftlint rules -------------------------------------------------------------------------------- /EWDatePicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EWDatePicker 2 | [![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu) 3 | 4 | 弹出半透明viewController的时间选择器 5 | 6 | # 实现效果: 7 | 8 | controller弹出时:半透明背景渐变展示.时间选择器从下方弹出.选择器日期滚动到当前日期. 9 | 10 | 点击确认进行将数据回调到上一控制器,点击页面空白区域退出controller. 11 | 12 | controller消失时:背景渐变消失,时间选择器向下退出. 13 | 14 | ![效果图预览](https://github.com/WangLiquan/EWDatePicker/raw/master/images/demonstration.gif) 15 | 16 | -------------------------------------------------------------------------------- /EWDatePickerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /EWDatePickerUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /EWDatePicker/CommonHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CommonHelper.swift 3 | // EWDatePicker 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | struct ScreenInfo { 13 | static let Frame = UIScreen.main.bounds 14 | static let Height = Frame.height 15 | static let Width = Frame.width 16 | static let navigationHeight:CGFloat = navBarHeight() 17 | 18 | static func isIphoneX() -> Bool { 19 | return UIScreen.main.bounds.equalTo(CGRect(x: 0, y: 0, width: 375, height: 812)) 20 | } 21 | static private func navBarHeight() -> CGFloat { 22 | return isIphoneX() ? 88 : 64 23 | } 24 | } 25 | //便捷的类方法 26 | extension UIColor { 27 | class func colorWithRGBA(r:CGFloat,g:CGFloat,b:CGFloat,a:CGFloat) -> UIColor { 28 | return UIColor(red: r/255, green: g/255, blue: b/255, alpha: a) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /EWDatePickerTests/EWDatePickerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EWDatePickerTests.swift 3 | // EWDatePickerTests 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import EWDatePicker 11 | 12 | class EWDatePickerTests: 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 | } 37 | -------------------------------------------------------------------------------- /EWDatePickerUITests/EWDatePickerUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EWDatePickerUITests.swift 3 | // EWDatePickerUITests 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class EWDatePickerUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /EWDatePicker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /EWDatePicker/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 | -------------------------------------------------------------------------------- /.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 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /EWDatePicker/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 | -------------------------------------------------------------------------------- /EWDatePicker/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" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /EWDatePicker/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // EWDatePicker 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. 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 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // 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. 23 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(_ application: UIApplication) { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(_ application: UIApplication) { 32 | // 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. 33 | } 34 | 35 | func applicationDidBecomeActive(_ application: UIApplication) { 36 | // 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. 37 | } 38 | 39 | func applicationWillTerminate(_ application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /EWDatePicker/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // EWDatePicker 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | private var currentDateCom: DateComponents = Calendar.current.dateComponents([.year, .month, .day], from: Date()) 14 | 15 | let label: UILabel = { 16 | let label = UILabel(frame: CGRect(x: 100, y: 250, width: ScreenInfo.Width - 200, height: 50)) 17 | label.textAlignment = .center 18 | label.backgroundColor = UIColor.colorWithRGBA(r: 255, g: 51, b: 102, a: 1) 19 | return label 20 | }() 21 | let button: UIButton = { 22 | let button = UIButton(frame: CGRect(x: 100, y: 450, width: ScreenInfo.Width - 200, height: 50)) 23 | button.addTarget(self, action: #selector(onClickSelectButton), for: .touchUpInside) 24 | button.setTitleColor(UIColor.colorWithRGBA(r: 255, g: 51, b: 102, a: 1), for: .normal) 25 | button.setTitle("选择日期", for: .normal) 26 | return button 27 | }() 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | self.view.addSubview(label) 32 | self.view.addSubview(button) 33 | // Do any additional setup after loading the view, typically from a nib. 34 | } 35 | 36 | @objc func onClickSelectButton() { 37 | let dataPicker = EWDatePickerViewController() 38 | self.definesPresentationContext = true 39 | /// 回调显示方法 40 | dataPicker.backDate = { [weak self] date in 41 | let dateFormatter = DateFormatter() 42 | dateFormatter.dateFormat = "YYYY-MM-dd" 43 | let dateString: String = dateFormatter.string(from: date) 44 | self?.label.text = dateString 45 | } 46 | dataPicker.view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.3) 47 | dataPicker.picker.reloadAllComponents() 48 | /// 弹出时日期滚动到当前日期效果 49 | self.present(dataPicker, animated: true) { 50 | dataPicker.picker.selectRow(0, inComponent: 0, animated: true) 51 | dataPicker.picker.selectRow((self.currentDateCom.month!) - 1, inComponent: 1, animated: true) 52 | dataPicker.picker.selectRow((self.currentDateCom.day!) - 1, inComponent: 2, animated: true) 53 | } 54 | } 55 | 56 | override func didReceiveMemoryWarning() { 57 | super.didReceiveMemoryWarning() 58 | // Dispose of any resources that can be recreated. 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /EWDatePicker/EWDataPickerPresentAnimated.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EWDataPickerPresentAnimated.swift 3 | // EWDatePicker 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum EWDatePickerPresentAnimateType { 12 | case present//被推出时 13 | case dismiss//取消时 14 | } 15 | 16 | //EWDatePickerViewController的推出和取消动画 17 | class EWDatePickerPresentAnimated: NSObject,UIViewControllerAnimatedTransitioning { 18 | 19 | var type: EWDatePickerPresentAnimateType = .present 20 | 21 | init(type: EWDatePickerPresentAnimateType) { 22 | self.type = type 23 | } 24 | /// 动画时间 25 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 26 | return 0.3 27 | } 28 | /// 动画效果 29 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 30 | 31 | switch type { 32 | case .present: 33 | guard let toVC = transitionContext.viewController(forKey: .to) as? EWDatePickerViewController else { 34 | return 35 | } 36 | // let toVC : EWDatePickerViewController = transitionContext.viewController(forKey: .to) as? EWDatePickerViewController 37 | let toView = toVC.view 38 | 39 | let containerView = transitionContext.containerView 40 | containerView.addSubview(toView!) 41 | 42 | toVC.containV.transform = CGAffineTransform(translationX: 0, y: (toVC.containV.frame.height)) 43 | 44 | UIView.animate(withDuration: 0.25, animations: { 45 | /// 背景变色 46 | toVC.backgroundView.alpha = 1.0 47 | /// datepicker向上推出 48 | toVC.containV.transform = CGAffineTransform(translationX: 0, y: -10) 49 | }) { ( _ ) in 50 | UIView.animate(withDuration: 0.2, animations: { 51 | /// transform初始化 52 | toVC.containV.transform = CGAffineTransform.identity 53 | }, completion: { (_) in 54 | transitionContext.completeTransition(true) 55 | }) 56 | } 57 | case .dismiss: 58 | guard let toVC = transitionContext.viewController(forKey: .from) as? EWDatePickerViewController else { 59 | return 60 | } 61 | UIView.animate(withDuration: 0.25, animations: { 62 | toVC.backgroundView.alpha = 0.0 63 | /// datepicker向下推回 64 | toVC.containV.transform = CGAffineTransform(translationX: 0, y: (toVC.containV.frame.height)) 65 | }) { (_) in 66 | transitionContext.completeTransition(true) 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /EWDatePicker/EWDatePickerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EWDatePickerViewController.swift 3 | // EWDatePicker 4 | // 5 | // Created by Ethan.Wang on 2018/8/27. 6 | // Copyright © 2018年 Ethan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class EWDatePickerViewController: UIViewController { 12 | 13 | var backDate: ((Date) -> Void)? 14 | ///获取当前日期 15 | private var currentDateCom: DateComponents = Calendar.current.dateComponents([.year, .month, .day], from: Date()) //日期类型 16 | var containV:UIView = { 17 | let view = UIView(frame: CGRect(x: 0, y: ScreenInfo.Height-240, width: ScreenInfo.Width, height: 240)) 18 | view.backgroundColor = UIColor.white 19 | return view 20 | }() 21 | var backgroundView:UIView = { 22 | let view = UIView() 23 | view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4) 24 | return view 25 | }() 26 | var picker: UIPickerView! 27 | 28 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 29 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 30 | } 31 | 32 | required init?(coder aDecoder: NSCoder) { 33 | fatalError("init(coder:) has not been implemented") 34 | } 35 | // MARK: - 生命周期 36 | override func viewDidLoad() { 37 | super.viewDidLoad() 38 | drawMyView() 39 | } 40 | // MARK: - Func 41 | private func drawMyView() { 42 | self.view.backgroundColor = UIColor.clear 43 | self.view.insertSubview(self.backgroundView, at: 0) 44 | self.modalPresentationStyle = .custom//viewcontroller弹出后之前控制器页面不隐藏 .custom代表自定义 45 | 46 | let cancel = UIButton(frame: CGRect(x: 0, y: 10, width: 70, height: 20)) 47 | let sure = UIButton(frame: CGRect(x: ScreenInfo.Width - 80, y: 10, width: 70, height: 20)) 48 | cancel.setTitle("取消", for: .normal) 49 | sure.setTitle("确认", for: .normal) 50 | cancel.setTitleColor(UIColor.colorWithRGBA(r: 255, g: 51, b: 102, a: 1), for: .normal) 51 | sure.setTitleColor(UIColor.colorWithRGBA(r: 255, g: 51, b: 102, a: 1), for: .normal) 52 | cancel.addTarget(self, action: #selector(self.onClickCancel), for: .touchUpInside) 53 | sure.addTarget(self, action: #selector(self.onClickSure), for: .touchUpInside) 54 | picker = UIPickerView(frame: CGRect(x: 0, y: 24, width: ScreenInfo.Width, height: 216)) 55 | picker.delegate = self 56 | picker.dataSource = self 57 | picker.backgroundColor = UIColor.clear 58 | picker.clipsToBounds = true//如果子视图的范围超出了父视图的边界,那么超出的部分就会被裁剪掉。 59 | //创建日期选择器 60 | self.containV.addSubview(cancel) 61 | self.containV.addSubview(sure) 62 | self.containV.addSubview(picker) 63 | self.view.addSubview(self.containV) 64 | 65 | self.transitioningDelegate = self as UIViewControllerTransitioningDelegate//自定义转场动画 66 | } 67 | 68 | // MARK: onClick 69 | @objc func onClickCancel() { 70 | self.dismiss(animated: true, completion: nil) 71 | } 72 | @objc func onClickSure() { 73 | let dateString = String(format: "%02ld-%02ld-%02ld", self.picker.selectedRow(inComponent: 0) + (self.currentDateCom.year!), self.picker.selectedRow(inComponent: 1) + 1, self.picker.selectedRow(inComponent: 2) + 1) 74 | let dateFormatter = DateFormatter() 75 | dateFormatter.dateFormat = "YYYY-MM-dd" 76 | /// 直接回调显示 77 | if self.backDate != nil { 78 | self.backDate!(dateFormatter.date(from: dateString) ?? Date()) 79 | } 80 | /*** 如果需求需要不能选择已经过去的日期 81 | let dateSelect = dateFormatter.date(from: dateString) 82 | let date = Date() 83 | let calendar = Calendar.current 84 | let dateNowString = String(format: "%02ld-%02ld-%02ld", calendar.component(.year, from: date) , calendar.component(.month, from: date), calendar.component(.day, from: date)) 85 | 86 | /// 判断选择日期与当前日期关系 87 | let result:ComparisonResult = (dateSelect?.compare(dateFormatter.date(from: dateNowString)!))! 88 | 89 | if result == ComparisonResult.orderedAscending { 90 | /// 选择日期在当前日期之前,可以选择使用toast提示用户. 91 | return 92 | }else{ 93 | /// 选择日期在当前日期之后. 正常调用 94 | if self.backDate != nil{ 95 | self.backDate!(dateFormatter.date(from: dateString) ?? Date()) 96 | } 97 | } 98 | */ 99 | self.dismiss(animated: true, completion: nil) 100 | } 101 | ///点击任意位置view消失 102 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 103 | super.touchesBegan(touches, with: event) 104 | let currentPoint = touches.first?.location(in: self.view) 105 | if !self.containV.frame.contains(currentPoint ?? CGPoint()) { 106 | self.dismiss(animated: true, completion: nil) 107 | } 108 | } 109 | 110 | override func didReceiveMemoryWarning() { 111 | super.didReceiveMemoryWarning() 112 | // Dispose of any resources that can be recreated. 113 | } 114 | 115 | } 116 | // MARK: - PickerViewDelegate 117 | extension EWDatePickerViewController:UIPickerViewDelegate,UIPickerViewDataSource { 118 | func numberOfComponents(in pickerView: UIPickerView) -> Int { 119 | return 3 120 | } 121 | func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 122 | if component == 0 { 123 | return 10 124 | } else if component == 1 { 125 | return 12 126 | } else { 127 | let year: Int = pickerView.selectedRow(inComponent: 0) + currentDateCom.year! 128 | let month: Int = pickerView.selectedRow(inComponent: 1) + 1 129 | let days: Int = howManyDays(inThisYear: year, withMonth: month) 130 | return days 131 | } 132 | } 133 | private func howManyDays(inThisYear year: Int, withMonth month: Int) -> Int { 134 | if (month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12) { 135 | return 31 136 | } 137 | if (month == 4) || (month == 6) || (month == 9) || (month == 11) { 138 | return 30 139 | } 140 | if (year % 4 == 1) || (year % 4 == 2) || (year % 4 == 3) { 141 | return 28 142 | } 143 | if year % 400 == 0 { 144 | return 29 145 | } 146 | if year % 100 == 0 { 147 | return 28 148 | } 149 | return 29 150 | } 151 | func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { 152 | return ScreenInfo.Width / 3 153 | } 154 | func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { 155 | return 40 156 | } 157 | func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 158 | if component == 0 { 159 | return "\((currentDateCom.year!) + row)\("年")" 160 | } else if component == 1 { 161 | return "\(row + 1)\("月")" 162 | } else { 163 | return "\(row + 1)\("日")" 164 | } 165 | } 166 | func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 167 | if component == 1 { 168 | pickerView.reloadComponent(2) 169 | } 170 | } 171 | } 172 | // MARK: - 转场动画delegate 173 | extension EWDatePickerViewController:UIViewControllerTransitioningDelegate { 174 | func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 175 | let animated = EWDatePickerPresentAnimated(type: .present) 176 | return animated 177 | } 178 | func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 179 | let animated = EWDatePickerPresentAnimated(type: .dismiss) 180 | return animated 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /EWDatePicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7950761E2133F3870051B366 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950761D2133F3870051B366 /* AppDelegate.swift */; }; 11 | 795076202133F3870051B366 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950761F2133F3870051B366 /* ViewController.swift */; }; 12 | 795076232133F3870051B366 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 795076212133F3870051B366 /* Main.storyboard */; }; 13 | 795076252133F38F0051B366 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 795076242133F38F0051B366 /* Assets.xcassets */; }; 14 | 795076282133F3900051B366 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 795076262133F3900051B366 /* LaunchScreen.storyboard */; }; 15 | 795076332133F3900051B366 /* EWDatePickerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 795076322133F3900051B366 /* EWDatePickerTests.swift */; }; 16 | 7950763E2133F3900051B366 /* EWDatePickerUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950763D2133F3900051B366 /* EWDatePickerUITests.swift */; }; 17 | 7950764C2133F4650051B366 /* EWDatePickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950764B2133F4650051B366 /* EWDatePickerViewController.swift */; }; 18 | 7950764E2133F66C0051B366 /* EWDataPickerPresentAnimated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950764D2133F66C0051B366 /* EWDataPickerPresentAnimated.swift */; }; 19 | 795076502133FC7F0051B366 /* CommonHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7950764F2133FC7F0051B366 /* CommonHelper.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 7950762F2133F3900051B366 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 795076122133F3870051B366 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 795076192133F3870051B366; 28 | remoteInfo = EWDatePicker; 29 | }; 30 | 7950763A2133F3900051B366 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 795076122133F3870051B366 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 795076192133F3870051B366; 35 | remoteInfo = EWDatePicker; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 7950761A2133F3870051B366 /* EWDatePicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EWDatePicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 7950761D2133F3870051B366 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | 7950761F2133F3870051B366 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 43 | 795076222133F3870051B366 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 795076242133F38F0051B366 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 795076272133F3900051B366 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 795076292133F3900051B366 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 7950762E2133F3900051B366 /* EWDatePickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EWDatePickerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 795076322133F3900051B366 /* EWDatePickerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EWDatePickerTests.swift; sourceTree = ""; }; 49 | 795076342133F3900051B366 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 795076392133F3900051B366 /* EWDatePickerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EWDatePickerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 7950763D2133F3900051B366 /* EWDatePickerUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EWDatePickerUITests.swift; sourceTree = ""; }; 52 | 7950763F2133F3900051B366 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 7950764B2133F4650051B366 /* EWDatePickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EWDatePickerViewController.swift; sourceTree = ""; }; 54 | 7950764D2133F66C0051B366 /* EWDataPickerPresentAnimated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EWDataPickerPresentAnimated.swift; sourceTree = ""; }; 55 | 7950764F2133FC7F0051B366 /* CommonHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonHelper.swift; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 795076172133F3870051B366 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 7950762B2133F3900051B366 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 795076362133F3900051B366 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 795076112133F3870051B366 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 7950761C2133F3870051B366 /* EWDatePicker */, 87 | 795076312133F3900051B366 /* EWDatePickerTests */, 88 | 7950763C2133F3900051B366 /* EWDatePickerUITests */, 89 | 7950761B2133F3870051B366 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 7950761B2133F3870051B366 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 7950761A2133F3870051B366 /* EWDatePicker.app */, 97 | 7950762E2133F3900051B366 /* EWDatePickerTests.xctest */, 98 | 795076392133F3900051B366 /* EWDatePickerUITests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 7950761C2133F3870051B366 /* EWDatePicker */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 7950764F2133FC7F0051B366 /* CommonHelper.swift */, 107 | 7950761D2133F3870051B366 /* AppDelegate.swift */, 108 | 7950761F2133F3870051B366 /* ViewController.swift */, 109 | 7950764B2133F4650051B366 /* EWDatePickerViewController.swift */, 110 | 7950764D2133F66C0051B366 /* EWDataPickerPresentAnimated.swift */, 111 | 795076212133F3870051B366 /* Main.storyboard */, 112 | 795076242133F38F0051B366 /* Assets.xcassets */, 113 | 795076262133F3900051B366 /* LaunchScreen.storyboard */, 114 | 795076292133F3900051B366 /* Info.plist */, 115 | ); 116 | path = EWDatePicker; 117 | sourceTree = ""; 118 | }; 119 | 795076312133F3900051B366 /* EWDatePickerTests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 795076322133F3900051B366 /* EWDatePickerTests.swift */, 123 | 795076342133F3900051B366 /* Info.plist */, 124 | ); 125 | path = EWDatePickerTests; 126 | sourceTree = ""; 127 | }; 128 | 7950763C2133F3900051B366 /* EWDatePickerUITests */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 7950763D2133F3900051B366 /* EWDatePickerUITests.swift */, 132 | 7950763F2133F3900051B366 /* Info.plist */, 133 | ); 134 | path = EWDatePickerUITests; 135 | sourceTree = ""; 136 | }; 137 | /* End PBXGroup section */ 138 | 139 | /* Begin PBXNativeTarget section */ 140 | 795076192133F3870051B366 /* EWDatePicker */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = 795076422133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePicker" */; 143 | buildPhases = ( 144 | 795076162133F3870051B366 /* Sources */, 145 | 795076172133F3870051B366 /* Frameworks */, 146 | 795076182133F3870051B366 /* Resources */, 147 | 7985883D2238D1B400F21106 /* ShellScript */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = EWDatePicker; 154 | productName = EWDatePicker; 155 | productReference = 7950761A2133F3870051B366 /* EWDatePicker.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | 7950762D2133F3900051B366 /* EWDatePickerTests */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 795076452133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePickerTests" */; 161 | buildPhases = ( 162 | 7950762A2133F3900051B366 /* Sources */, 163 | 7950762B2133F3900051B366 /* Frameworks */, 164 | 7950762C2133F3900051B366 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | 795076302133F3900051B366 /* PBXTargetDependency */, 170 | ); 171 | name = EWDatePickerTests; 172 | productName = EWDatePickerTests; 173 | productReference = 7950762E2133F3900051B366 /* EWDatePickerTests.xctest */; 174 | productType = "com.apple.product-type.bundle.unit-test"; 175 | }; 176 | 795076382133F3900051B366 /* EWDatePickerUITests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 795076482133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePickerUITests" */; 179 | buildPhases = ( 180 | 795076352133F3900051B366 /* Sources */, 181 | 795076362133F3900051B366 /* Frameworks */, 182 | 795076372133F3900051B366 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 7950763B2133F3900051B366 /* PBXTargetDependency */, 188 | ); 189 | name = EWDatePickerUITests; 190 | productName = EWDatePickerUITests; 191 | productReference = 795076392133F3900051B366 /* EWDatePickerUITests.xctest */; 192 | productType = "com.apple.product-type.bundle.ui-testing"; 193 | }; 194 | /* End PBXNativeTarget section */ 195 | 196 | /* Begin PBXProject section */ 197 | 795076122133F3870051B366 /* Project object */ = { 198 | isa = PBXProject; 199 | attributes = { 200 | CLASSPREFIX = EW; 201 | LastSwiftUpdateCheck = 0940; 202 | LastUpgradeCheck = 0940; 203 | ORGANIZATIONNAME = Ethan; 204 | TargetAttributes = { 205 | 795076192133F3870051B366 = { 206 | CreatedOnToolsVersion = 9.4.1; 207 | LastSwiftMigration = 1000; 208 | }; 209 | 7950762D2133F3900051B366 = { 210 | CreatedOnToolsVersion = 9.4.1; 211 | LastSwiftMigration = 1020; 212 | TestTargetID = 795076192133F3870051B366; 213 | }; 214 | 795076382133F3900051B366 = { 215 | CreatedOnToolsVersion = 9.4.1; 216 | LastSwiftMigration = 1020; 217 | TestTargetID = 795076192133F3870051B366; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 795076152133F3870051B366 /* Build configuration list for PBXProject "EWDatePicker" */; 222 | compatibilityVersion = "Xcode 9.3"; 223 | developmentRegion = en; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = 795076112133F3870051B366; 230 | productRefGroup = 7950761B2133F3870051B366 /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 795076192133F3870051B366 /* EWDatePicker */, 235 | 7950762D2133F3900051B366 /* EWDatePickerTests */, 236 | 795076382133F3900051B366 /* EWDatePickerUITests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 795076182133F3870051B366 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 795076282133F3900051B366 /* LaunchScreen.storyboard in Resources */, 247 | 795076252133F38F0051B366 /* Assets.xcassets in Resources */, 248 | 795076232133F3870051B366 /* Main.storyboard in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 7950762C2133F3900051B366 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | 795076372133F3900051B366 /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXResourcesBuildPhase section */ 267 | 268 | /* Begin PBXShellScriptBuildPhase section */ 269 | 7985883D2238D1B400F21106 /* ShellScript */ = { 270 | isa = PBXShellScriptBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | ); 274 | inputFileListPaths = ( 275 | ); 276 | inputPaths = ( 277 | ); 278 | outputFileListPaths = ( 279 | ); 280 | outputPaths = ( 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | shellPath = /bin/sh; 284 | shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; 285 | }; 286 | /* End PBXShellScriptBuildPhase section */ 287 | 288 | /* Begin PBXSourcesBuildPhase section */ 289 | 795076162133F3870051B366 /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 7950764E2133F66C0051B366 /* EWDataPickerPresentAnimated.swift in Sources */, 294 | 795076502133FC7F0051B366 /* CommonHelper.swift in Sources */, 295 | 795076202133F3870051B366 /* ViewController.swift in Sources */, 296 | 7950764C2133F4650051B366 /* EWDatePickerViewController.swift in Sources */, 297 | 7950761E2133F3870051B366 /* AppDelegate.swift in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 7950762A2133F3900051B366 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 795076332133F3900051B366 /* EWDatePickerTests.swift in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | 795076352133F3900051B366 /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 7950763E2133F3900051B366 /* EWDatePickerUITests.swift in Sources */, 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | /* End PBXSourcesBuildPhase section */ 318 | 319 | /* Begin PBXTargetDependency section */ 320 | 795076302133F3900051B366 /* PBXTargetDependency */ = { 321 | isa = PBXTargetDependency; 322 | target = 795076192133F3870051B366 /* EWDatePicker */; 323 | targetProxy = 7950762F2133F3900051B366 /* PBXContainerItemProxy */; 324 | }; 325 | 7950763B2133F3900051B366 /* PBXTargetDependency */ = { 326 | isa = PBXTargetDependency; 327 | target = 795076192133F3870051B366 /* EWDatePicker */; 328 | targetProxy = 7950763A2133F3900051B366 /* PBXContainerItemProxy */; 329 | }; 330 | /* End PBXTargetDependency section */ 331 | 332 | /* Begin PBXVariantGroup section */ 333 | 795076212133F3870051B366 /* Main.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 795076222133F3870051B366 /* Base */, 337 | ); 338 | name = Main.storyboard; 339 | sourceTree = ""; 340 | }; 341 | 795076262133F3900051B366 /* LaunchScreen.storyboard */ = { 342 | isa = PBXVariantGroup; 343 | children = ( 344 | 795076272133F3900051B366 /* Base */, 345 | ); 346 | name = LaunchScreen.storyboard; 347 | sourceTree = ""; 348 | }; 349 | /* End PBXVariantGroup section */ 350 | 351 | /* Begin XCBuildConfiguration section */ 352 | 795076402133F3900051B366 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ALWAYS_SEARCH_USER_PATHS = NO; 356 | CLANG_ANALYZER_NONNULL = YES; 357 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 358 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 359 | CLANG_CXX_LIBRARY = "libc++"; 360 | CLANG_ENABLE_MODULES = YES; 361 | CLANG_ENABLE_OBJC_ARC = YES; 362 | CLANG_ENABLE_OBJC_WEAK = YES; 363 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 364 | CLANG_WARN_BOOL_CONVERSION = YES; 365 | CLANG_WARN_COMMA = YES; 366 | CLANG_WARN_CONSTANT_CONVERSION = YES; 367 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 369 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 370 | CLANG_WARN_EMPTY_BODY = YES; 371 | CLANG_WARN_ENUM_CONVERSION = YES; 372 | CLANG_WARN_INFINITE_RECURSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 375 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 376 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 378 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 379 | CLANG_WARN_STRICT_PROTOTYPES = YES; 380 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 381 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | CODE_SIGN_IDENTITY = "iPhone Developer"; 385 | COPY_PHASE_STRIP = NO; 386 | DEBUG_INFORMATION_FORMAT = dwarf; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | ENABLE_TESTABILITY = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu11; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_OPTIMIZATION_LEVEL = 0; 393 | GCC_PREPROCESSOR_DEFINITIONS = ( 394 | "DEBUG=1", 395 | "$(inherited)", 396 | ); 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 404 | MTL_ENABLE_DEBUG_INFO = YES; 405 | ONLY_ACTIVE_ARCH = YES; 406 | SDKROOT = iphoneos; 407 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 408 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 409 | }; 410 | name = Debug; 411 | }; 412 | 795076412133F3900051B366 /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | ALWAYS_SEARCH_USER_PATHS = NO; 416 | CLANG_ANALYZER_NONNULL = YES; 417 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 418 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 419 | CLANG_CXX_LIBRARY = "libc++"; 420 | CLANG_ENABLE_MODULES = YES; 421 | CLANG_ENABLE_OBJC_ARC = YES; 422 | CLANG_ENABLE_OBJC_WEAK = YES; 423 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_COMMA = YES; 426 | CLANG_WARN_CONSTANT_CONVERSION = YES; 427 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 428 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 429 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 430 | CLANG_WARN_EMPTY_BODY = YES; 431 | CLANG_WARN_ENUM_CONVERSION = YES; 432 | CLANG_WARN_INFINITE_RECURSION = YES; 433 | CLANG_WARN_INT_CONVERSION = YES; 434 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 435 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 436 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 437 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 438 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 439 | CLANG_WARN_STRICT_PROTOTYPES = YES; 440 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 441 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 442 | CLANG_WARN_UNREACHABLE_CODE = YES; 443 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 444 | CODE_SIGN_IDENTITY = "iPhone Developer"; 445 | COPY_PHASE_STRIP = NO; 446 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 447 | ENABLE_NS_ASSERTIONS = NO; 448 | ENABLE_STRICT_OBJC_MSGSEND = YES; 449 | GCC_C_LANGUAGE_STANDARD = gnu11; 450 | GCC_NO_COMMON_BLOCKS = YES; 451 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 452 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 453 | GCC_WARN_UNDECLARED_SELECTOR = YES; 454 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 455 | GCC_WARN_UNUSED_FUNCTION = YES; 456 | GCC_WARN_UNUSED_VARIABLE = YES; 457 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 458 | MTL_ENABLE_DEBUG_INFO = NO; 459 | SDKROOT = iphoneos; 460 | SWIFT_COMPILATION_MODE = wholemodule; 461 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 462 | VALIDATE_PRODUCT = YES; 463 | }; 464 | name = Release; 465 | }; 466 | 795076432133F3900051B366 /* Debug */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 470 | CODE_SIGN_STYLE = Automatic; 471 | DEVELOPMENT_TEAM = 968Q63C2Z7; 472 | INFOPLIST_FILE = EWDatePicker/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = ( 474 | "$(inherited)", 475 | "@executable_path/Frameworks", 476 | ); 477 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePicker; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | SWIFT_VERSION = 5.0; 480 | TARGETED_DEVICE_FAMILY = "1,2"; 481 | }; 482 | name = Debug; 483 | }; 484 | 795076442133F3900051B366 /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CODE_SIGN_STYLE = Automatic; 489 | DEVELOPMENT_TEAM = 968Q63C2Z7; 490 | INFOPLIST_FILE = EWDatePicker/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = ( 492 | "$(inherited)", 493 | "@executable_path/Frameworks", 494 | ); 495 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePicker; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | SWIFT_VERSION = 5.0; 498 | TARGETED_DEVICE_FAMILY = "1,2"; 499 | }; 500 | name = Release; 501 | }; 502 | 795076462133F3900051B366 /* Debug */ = { 503 | isa = XCBuildConfiguration; 504 | buildSettings = { 505 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 506 | BUNDLE_LOADER = "$(TEST_HOST)"; 507 | CODE_SIGN_STYLE = Automatic; 508 | DEVELOPMENT_TEAM = B8V4DCL3BF; 509 | INFOPLIST_FILE = EWDatePickerTests/Info.plist; 510 | LD_RUNPATH_SEARCH_PATHS = ( 511 | "$(inherited)", 512 | "@executable_path/Frameworks", 513 | "@loader_path/Frameworks", 514 | ); 515 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePickerTests; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | SWIFT_VERSION = 5.0; 518 | TARGETED_DEVICE_FAMILY = "1,2"; 519 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EWDatePicker.app/EWDatePicker"; 520 | }; 521 | name = Debug; 522 | }; 523 | 795076472133F3900051B366 /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 527 | BUNDLE_LOADER = "$(TEST_HOST)"; 528 | CODE_SIGN_STYLE = Automatic; 529 | DEVELOPMENT_TEAM = B8V4DCL3BF; 530 | INFOPLIST_FILE = EWDatePickerTests/Info.plist; 531 | LD_RUNPATH_SEARCH_PATHS = ( 532 | "$(inherited)", 533 | "@executable_path/Frameworks", 534 | "@loader_path/Frameworks", 535 | ); 536 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePickerTests; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | SWIFT_VERSION = 5.0; 539 | TARGETED_DEVICE_FAMILY = "1,2"; 540 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EWDatePicker.app/EWDatePicker"; 541 | }; 542 | name = Release; 543 | }; 544 | 795076492133F3900051B366 /* Debug */ = { 545 | isa = XCBuildConfiguration; 546 | buildSettings = { 547 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 548 | CODE_SIGN_STYLE = Automatic; 549 | DEVELOPMENT_TEAM = B8V4DCL3BF; 550 | INFOPLIST_FILE = EWDatePickerUITests/Info.plist; 551 | LD_RUNPATH_SEARCH_PATHS = ( 552 | "$(inherited)", 553 | "@executable_path/Frameworks", 554 | "@loader_path/Frameworks", 555 | ); 556 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePickerUITests; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_VERSION = 5.0; 559 | TARGETED_DEVICE_FAMILY = "1,2"; 560 | TEST_TARGET_NAME = EWDatePicker; 561 | }; 562 | name = Debug; 563 | }; 564 | 7950764A2133F3900051B366 /* Release */ = { 565 | isa = XCBuildConfiguration; 566 | buildSettings = { 567 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 568 | CODE_SIGN_STYLE = Automatic; 569 | DEVELOPMENT_TEAM = B8V4DCL3BF; 570 | INFOPLIST_FILE = EWDatePickerUITests/Info.plist; 571 | LD_RUNPATH_SEARCH_PATHS = ( 572 | "$(inherited)", 573 | "@executable_path/Frameworks", 574 | "@loader_path/Frameworks", 575 | ); 576 | PRODUCT_BUNDLE_IDENTIFIER = com.Ethan.EWDatePickerUITests; 577 | PRODUCT_NAME = "$(TARGET_NAME)"; 578 | SWIFT_VERSION = 5.0; 579 | TARGETED_DEVICE_FAMILY = "1,2"; 580 | TEST_TARGET_NAME = EWDatePicker; 581 | }; 582 | name = Release; 583 | }; 584 | /* End XCBuildConfiguration section */ 585 | 586 | /* Begin XCConfigurationList section */ 587 | 795076152133F3870051B366 /* Build configuration list for PBXProject "EWDatePicker" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 795076402133F3900051B366 /* Debug */, 591 | 795076412133F3900051B366 /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | defaultConfigurationName = Release; 595 | }; 596 | 795076422133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePicker" */ = { 597 | isa = XCConfigurationList; 598 | buildConfigurations = ( 599 | 795076432133F3900051B366 /* Debug */, 600 | 795076442133F3900051B366 /* Release */, 601 | ); 602 | defaultConfigurationIsVisible = 0; 603 | defaultConfigurationName = Release; 604 | }; 605 | 795076452133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePickerTests" */ = { 606 | isa = XCConfigurationList; 607 | buildConfigurations = ( 608 | 795076462133F3900051B366 /* Debug */, 609 | 795076472133F3900051B366 /* Release */, 610 | ); 611 | defaultConfigurationIsVisible = 0; 612 | defaultConfigurationName = Release; 613 | }; 614 | 795076482133F3900051B366 /* Build configuration list for PBXNativeTarget "EWDatePickerUITests" */ = { 615 | isa = XCConfigurationList; 616 | buildConfigurations = ( 617 | 795076492133F3900051B366 /* Debug */, 618 | 7950764A2133F3900051B366 /* Release */, 619 | ); 620 | defaultConfigurationIsVisible = 0; 621 | defaultConfigurationName = Release; 622 | }; 623 | /* End XCConfigurationList section */ 624 | }; 625 | rootObject = 795076122133F3870051B366 /* Project object */; 626 | } 627 | --------------------------------------------------------------------------------