├── Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.23.png ├── Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.26.png ├── myCalender2.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── muskan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── muskan.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── myCalender2 ├── WeekdaysView.swift ├── Info.plist ├── Base.lproj │ └── LaunchScreen.storyboard ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── ViewController.swift ├── AppDelegate.swift ├── MonthView.swift └── CalenderView.swift └── README.md /Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akhilendra/calenderAppiOS/HEAD/Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.23.png -------------------------------------------------------------------------------- /Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akhilendra/calenderAppiOS/HEAD/Simulator Screen Shot - iPhone 6 - 2017-10-22 at 10.13.26.png -------------------------------------------------------------------------------- /myCalender2.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /myCalender2.xcodeproj/project.xcworkspace/xcuserdata/muskan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akhilendra/calenderAppiOS/HEAD/myCalender2.xcodeproj/project.xcworkspace/xcuserdata/muskan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /myCalender2.xcodeproj/xcuserdata/muskan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | myCalender2.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /myCalender2/WeekdaysView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeekdaysView.swift 3 | // myCalender2 4 | // 5 | // Created by Muskan on 10/22/17. 6 | // Copyright © 2017 akhil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class WeekdaysView: UIView { 12 | 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | self.backgroundColor=UIColor.clear 16 | 17 | setupViews() 18 | } 19 | 20 | func setupViews() { 21 | addSubview(myStackView) 22 | myStackView.topAnchor.constraint(equalTo: topAnchor).isActive=true 23 | myStackView.leftAnchor.constraint(equalTo: leftAnchor).isActive=true 24 | myStackView.rightAnchor.constraint(equalTo: rightAnchor).isActive=true 25 | myStackView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive=true 26 | 27 | var daysArr = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] 28 | for i in 0..<7 { 29 | let lbl=UILabel() 30 | lbl.text=daysArr[i] 31 | lbl.textAlignment = .center 32 | lbl.textColor = Style.weekdaysLblColor 33 | myStackView.addArrangedSubview(lbl) 34 | } 35 | } 36 | 37 | let myStackView: UIStackView = { 38 | let stackView=UIStackView() 39 | stackView.distribution = .fillEqually 40 | stackView.translatesAutoresizingMaskIntoConstraints=false 41 | return stackView 42 | }() 43 | 44 | required init?(coder aDecoder: NSCoder) { 45 | fatalError("init(coder:) has not been implemented") 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /myCalender2/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 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /myCalender2/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 | -------------------------------------------------------------------------------- /myCalender2/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 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /myCalender2/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // myCalender2 4 | // 5 | // Created by Muskan on 10/22/17. 6 | // Copyright © 2017 akhil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum MyTheme { 12 | case light 13 | case dark 14 | } 15 | 16 | class ViewController: UIViewController { 17 | 18 | var theme = MyTheme.dark 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | self.title = "My Calender" 23 | self.navigationController?.navigationBar.isTranslucent=false 24 | self.view.backgroundColor=Style.bgColor 25 | 26 | view.addSubview(calenderView) 27 | calenderView.topAnchor.constraint(equalTo: view.topAnchor, constant: 10).isActive=true 28 | calenderView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -12).isActive=true 29 | calenderView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 12).isActive=true 30 | calenderView.heightAnchor.constraint(equalToConstant: 365).isActive=true 31 | 32 | let rightBarBtn = UIBarButtonItem(title: "Light", style: .plain, target: self, action: #selector(rightBarBtnAction)) 33 | self.navigationItem.rightBarButtonItem = rightBarBtn 34 | } 35 | 36 | override func viewWillLayoutSubviews() { 37 | super.viewWillLayoutSubviews() 38 | calenderView.myCollectionView.collectionViewLayout.invalidateLayout() 39 | } 40 | 41 | @objc func rightBarBtnAction(sender: UIBarButtonItem) { 42 | if theme == .dark { 43 | sender.title = "Dark" 44 | theme = .light 45 | Style.themeLight() 46 | } else { 47 | sender.title = "Light" 48 | theme = .dark 49 | Style.themeDark() 50 | } 51 | self.view.backgroundColor=Style.bgColor 52 | calenderView.changeTheme() 53 | } 54 | 55 | let calenderView: CalenderView = { 56 | let v=CalenderView(theme: MyTheme.dark) 57 | v.translatesAutoresizingMaskIntoConstraints=false 58 | return v 59 | }() 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Calendar for iOS in Swift 4

2 | 3 | This is the sourcecode for the app in my tutorial on Youtube https://youtu.be/srJj8U5d5ok 4 |
5 | It can be used as a date picker in ios apps. You are free to use it in your projects. 6 | 7 |

8 | 9 |        10 | 11 |

12 | 13 | If you want to start the weekday from Monday rather than Sunday as in this project, below are the changes you need to make: 14 | 15 | Step 1. In WeekdaysView.swift file, replace daysArr with following: 16 | 17 | var daysArr = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] 18 | 19 | Step 2. In CalenderView.swift file: 20 | Replace function getFirstWeekDay with following: 21 | 22 | func getFirstWeekDay() -> Int { 23 | let day = ("\(currentYear)-\(currentMonthIndex)-01".date?.firstDayOfTheMonth.weekday)! //1-7 -> Sun-Sat 24 | return day == 1 ? 8 : day 25 | } 26 | 27 | Step 3. In CalenderView.swift file: 28 | Replace numberOfItemsInSection and cellForItemAt delegate functions of CollectionView with following: 29 | 30 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 31 | let numDays = numOfDaysInMonth[currentMonthIndex-1] 32 | let num = numDays + firstWeekDayOfMonth - 2 33 | return num 34 | } 35 | 36 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 37 | let cell=collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! dateCVCell 38 | cell.backgroundColor=UIColor.clear 39 | if indexPath.item <= firstWeekDayOfMonth - 3 { 40 | cell.isHidden=true 41 | } else { 42 | let calcDate = indexPath.row-firstWeekDayOfMonth+3 43 | cell.isHidden=false 44 | cell.lbl.text="\(calcDate)" 45 | if calcDate < todaysDate && currentYear == presentYear && currentMonthIndex == presentMonthIndex { 46 | cell.isUserInteractionEnabled=false 47 | cell.lbl.textColor = UIColor.lightGray 48 | } else { 49 | cell.isUserInteractionEnabled=true 50 | cell.lbl.textColor = Style.activeCellLblColor 51 | } 52 | } 53 | return cell 54 | } 55 | 56 | That's it. You're done. 57 | -------------------------------------------------------------------------------- /myCalender2/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // myCalender2 4 | // 5 | // Created by Muskan on 10/22/17. 6 | // Copyright © 2017 akhil. 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 | 20 | self.window = UIWindow(frame: UIScreen.main.bounds) 21 | if let window = self.window { 22 | window.backgroundColor = UIColor.white 23 | let nav = UINavigationController() 24 | let mainView = ViewController() 25 | nav.viewControllers = [mainView] 26 | window.rootViewController = nav 27 | window.makeKeyAndVisible() 28 | } 29 | 30 | return true 31 | } 32 | 33 | func applicationWillResignActive(_ application: UIApplication) { 34 | // 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. 35 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 36 | } 37 | 38 | func applicationDidEnterBackground(_ application: UIApplication) { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | func applicationWillEnterForeground(_ application: UIApplication) { 44 | // 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. 45 | } 46 | 47 | func applicationDidBecomeActive(_ application: UIApplication) { 48 | // 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. 49 | } 50 | 51 | func applicationWillTerminate(_ application: UIApplication) { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /myCalender2/MonthView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MonthView.swift 3 | // myCalender2 4 | // 5 | // Created by Muskan on 10/22/17. 6 | // Copyright © 2017 akhil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol MonthViewDelegate: class { 12 | func didChangeMonth(monthIndex: Int, year: Int) 13 | } 14 | 15 | class MonthView: UIView { 16 | var monthsArr = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] 17 | var currentMonthIndex = 0 18 | var currentYear: Int = 0 19 | var delegate: MonthViewDelegate? 20 | 21 | override init(frame: CGRect) { 22 | super.init(frame: frame) 23 | self.backgroundColor=UIColor.clear 24 | 25 | currentMonthIndex = Calendar.current.component(.month, from: Date()) - 1 26 | currentYear = Calendar.current.component(.year, from: Date()) 27 | 28 | setupViews() 29 | 30 | btnLeft.isEnabled=false 31 | } 32 | 33 | @objc func btnLeftRightAction(sender: UIButton) { 34 | if sender == btnRight { 35 | currentMonthIndex += 1 36 | if currentMonthIndex > 11 { 37 | currentMonthIndex = 0 38 | currentYear += 1 39 | } 40 | } else { 41 | currentMonthIndex -= 1 42 | if currentMonthIndex < 0 { 43 | currentMonthIndex = 11 44 | currentYear -= 1 45 | } 46 | } 47 | lblName.text="\(monthsArr[currentMonthIndex]) \(currentYear)" 48 | delegate?.didChangeMonth(monthIndex: currentMonthIndex, year: currentYear) 49 | } 50 | 51 | func setupViews() { 52 | self.addSubview(lblName) 53 | lblName.topAnchor.constraint(equalTo: topAnchor).isActive=true 54 | lblName.centerXAnchor.constraint(equalTo: centerXAnchor).isActive=true 55 | lblName.widthAnchor.constraint(equalToConstant: 150).isActive=true 56 | lblName.heightAnchor.constraint(equalTo: heightAnchor).isActive=true 57 | lblName.text="\(monthsArr[currentMonthIndex]) \(currentYear)" 58 | 59 | self.addSubview(btnRight) 60 | btnRight.topAnchor.constraint(equalTo: topAnchor).isActive=true 61 | btnRight.rightAnchor.constraint(equalTo: rightAnchor).isActive=true 62 | btnRight.widthAnchor.constraint(equalToConstant: 50).isActive=true 63 | btnRight.heightAnchor.constraint(equalTo: heightAnchor).isActive=true 64 | 65 | self.addSubview(btnLeft) 66 | btnLeft.topAnchor.constraint(equalTo: topAnchor).isActive=true 67 | btnLeft.leftAnchor.constraint(equalTo: leftAnchor).isActive=true 68 | btnLeft.widthAnchor.constraint(equalToConstant: 50).isActive=true 69 | btnLeft.heightAnchor.constraint(equalTo: heightAnchor).isActive=true 70 | } 71 | 72 | let lblName: UILabel = { 73 | let lbl=UILabel() 74 | lbl.text="Default Month Year text" 75 | lbl.textColor = Style.monthViewLblColor 76 | lbl.textAlignment = .center 77 | lbl.font=UIFont.boldSystemFont(ofSize: 16) 78 | lbl.translatesAutoresizingMaskIntoConstraints=false 79 | return lbl 80 | }() 81 | 82 | let btnRight: UIButton = { 83 | let btn=UIButton() 84 | btn.setTitle(">", for: .normal) 85 | btn.setTitleColor(Style.monthViewBtnRightColor, for: .normal) 86 | btn.translatesAutoresizingMaskIntoConstraints=false 87 | btn.addTarget(self, action: #selector(btnLeftRightAction(sender:)), for: .touchUpInside) 88 | return btn 89 | }() 90 | 91 | let btnLeft: UIButton = { 92 | let btn=UIButton() 93 | btn.setTitle("<", for: .normal) 94 | btn.setTitleColor(Style.monthViewBtnLeftColor, for: .normal) 95 | btn.translatesAutoresizingMaskIntoConstraints=false 96 | btn.addTarget(self, action: #selector(btnLeftRightAction(sender:)), for: .touchUpInside) 97 | btn.setTitleColor(UIColor.lightGray, for: .disabled) 98 | return btn 99 | }() 100 | 101 | required init?(coder aDecoder: NSCoder) { 102 | fatalError("init(coder:) has not been implemented") 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /myCalender2/CalenderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalenderView.swift 3 | // myCalender2 4 | // 5 | // Created by Muskan on 10/22/17. 6 | // Copyright © 2017 akhil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct Colors { 12 | static var darkGray = #colorLiteral(red: 0.3764705882, green: 0.3647058824, blue: 0.3647058824, alpha: 1) 13 | static var darkRed = #colorLiteral(red: 0.5019607843, green: 0.1529411765, blue: 0.1764705882, alpha: 1) 14 | } 15 | 16 | struct Style { 17 | static var bgColor = UIColor.white 18 | static var monthViewLblColor = UIColor.white 19 | static var monthViewBtnRightColor = UIColor.white 20 | static var monthViewBtnLeftColor = UIColor.white 21 | static var activeCellLblColor = UIColor.white 22 | static var activeCellLblColorHighlighted = UIColor.black 23 | static var weekdaysLblColor = UIColor.white 24 | 25 | static func themeDark(){ 26 | bgColor = Colors.darkGray 27 | monthViewLblColor = UIColor.white 28 | monthViewBtnRightColor = UIColor.white 29 | monthViewBtnLeftColor = UIColor.white 30 | activeCellLblColor = UIColor.white 31 | activeCellLblColorHighlighted = UIColor.black 32 | weekdaysLblColor = UIColor.white 33 | } 34 | 35 | static func themeLight(){ 36 | bgColor = UIColor.white 37 | monthViewLblColor = UIColor.black 38 | monthViewBtnRightColor = UIColor.black 39 | monthViewBtnLeftColor = UIColor.black 40 | activeCellLblColor = UIColor.black 41 | activeCellLblColorHighlighted = UIColor.white 42 | weekdaysLblColor = UIColor.black 43 | } 44 | } 45 | 46 | class CalenderView: UIView, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MonthViewDelegate { 47 | 48 | var numOfDaysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31] 49 | var currentMonthIndex: Int = 0 50 | var currentYear: Int = 0 51 | var presentMonthIndex = 0 52 | var presentYear = 0 53 | var todaysDate = 0 54 | var firstWeekDayOfMonth = 0 //(Sunday-Saturday 1-7) 55 | 56 | override init(frame: CGRect) { 57 | super.init(frame: frame) 58 | 59 | initializeView() 60 | } 61 | 62 | convenience init(theme: MyTheme) { 63 | self.init() 64 | 65 | if theme == .dark { 66 | Style.themeDark() 67 | } else { 68 | Style.themeLight() 69 | } 70 | 71 | initializeView() 72 | } 73 | 74 | func changeTheme() { 75 | myCollectionView.reloadData() 76 | 77 | monthView.lblName.textColor = Style.monthViewLblColor 78 | monthView.btnRight.setTitleColor(Style.monthViewBtnRightColor, for: .normal) 79 | monthView.btnLeft.setTitleColor(Style.monthViewBtnLeftColor, for: .normal) 80 | 81 | for i in 0..<7 { 82 | (weekdaysView.myStackView.subviews[i] as! UILabel).textColor = Style.weekdaysLblColor 83 | } 84 | } 85 | 86 | func initializeView() { 87 | currentMonthIndex = Calendar.current.component(.month, from: Date()) 88 | currentYear = Calendar.current.component(.year, from: Date()) 89 | todaysDate = Calendar.current.component(.day, from: Date()) 90 | firstWeekDayOfMonth=getFirstWeekDay() 91 | 92 | //for leap years, make february month of 29 days 93 | if currentMonthIndex == 2 && currentYear % 4 == 0 { 94 | numOfDaysInMonth[currentMonthIndex-1] = 29 95 | } 96 | //end 97 | 98 | presentMonthIndex=currentMonthIndex 99 | presentYear=currentYear 100 | 101 | setupViews() 102 | 103 | myCollectionView.delegate=self 104 | myCollectionView.dataSource=self 105 | myCollectionView.register(dateCVCell.self, forCellWithReuseIdentifier: "Cell") 106 | } 107 | 108 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 109 | return numOfDaysInMonth[currentMonthIndex-1] + firstWeekDayOfMonth - 1 110 | } 111 | 112 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 113 | let cell=collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! dateCVCell 114 | cell.backgroundColor=UIColor.clear 115 | if indexPath.item <= firstWeekDayOfMonth - 2 { 116 | cell.isHidden=true 117 | } else { 118 | let calcDate = indexPath.row-firstWeekDayOfMonth+2 119 | cell.isHidden=false 120 | cell.lbl.text="\(calcDate)" 121 | if calcDate < todaysDate && currentYear == presentYear && currentMonthIndex == presentMonthIndex { 122 | cell.isUserInteractionEnabled=false 123 | cell.lbl.textColor = UIColor.lightGray 124 | } else { 125 | cell.isUserInteractionEnabled=true 126 | cell.lbl.textColor = Style.activeCellLblColor 127 | } 128 | } 129 | return cell 130 | } 131 | 132 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 133 | let cell=collectionView.cellForItem(at: indexPath) 134 | cell?.backgroundColor=Colors.darkRed 135 | let lbl = cell?.subviews[1] as! UILabel 136 | lbl.textColor=UIColor.white 137 | } 138 | 139 | func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) { 140 | let cell=collectionView.cellForItem(at: indexPath) 141 | cell?.backgroundColor=UIColor.clear 142 | let lbl = cell?.subviews[1] as! UILabel 143 | lbl.textColor = Style.activeCellLblColor 144 | } 145 | 146 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 147 | let width = collectionView.frame.width/7 - 8 148 | let height: CGFloat = 40 149 | return CGSize(width: width, height: height) 150 | } 151 | 152 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { 153 | return 8.0 154 | } 155 | 156 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { 157 | return 8.0 158 | } 159 | 160 | func getFirstWeekDay() -> Int { 161 | let day = ("\(currentYear)-\(currentMonthIndex)-01".date?.firstDayOfTheMonth.weekday)! 162 | //return day == 7 ? 1 : day 163 | return day 164 | } 165 | 166 | func didChangeMonth(monthIndex: Int, year: Int) { 167 | currentMonthIndex=monthIndex+1 168 | currentYear = year 169 | 170 | //for leap year, make february month of 29 days 171 | if monthIndex == 1 { 172 | if currentYear % 4 == 0 { 173 | numOfDaysInMonth[monthIndex] = 29 174 | } else { 175 | numOfDaysInMonth[monthIndex] = 28 176 | } 177 | } 178 | //end 179 | 180 | firstWeekDayOfMonth=getFirstWeekDay() 181 | 182 | myCollectionView.reloadData() 183 | 184 | monthView.btnLeft.isEnabled = !(currentMonthIndex == presentMonthIndex && currentYear == presentYear) 185 | } 186 | 187 | func setupViews() { 188 | addSubview(monthView) 189 | monthView.topAnchor.constraint(equalTo: topAnchor).isActive=true 190 | monthView.leftAnchor.constraint(equalTo: leftAnchor).isActive=true 191 | monthView.rightAnchor.constraint(equalTo: rightAnchor).isActive=true 192 | monthView.heightAnchor.constraint(equalToConstant: 35).isActive=true 193 | monthView.delegate=self 194 | 195 | addSubview(weekdaysView) 196 | weekdaysView.topAnchor.constraint(equalTo: monthView.bottomAnchor).isActive=true 197 | weekdaysView.leftAnchor.constraint(equalTo: leftAnchor).isActive=true 198 | weekdaysView.rightAnchor.constraint(equalTo: rightAnchor).isActive=true 199 | weekdaysView.heightAnchor.constraint(equalToConstant: 30).isActive=true 200 | 201 | addSubview(myCollectionView) 202 | myCollectionView.topAnchor.constraint(equalTo: weekdaysView.bottomAnchor, constant: 0).isActive=true 203 | myCollectionView.leftAnchor.constraint(equalTo: leftAnchor, constant: 0).isActive=true 204 | myCollectionView.rightAnchor.constraint(equalTo: rightAnchor, constant: 0).isActive=true 205 | myCollectionView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive=true 206 | } 207 | 208 | let monthView: MonthView = { 209 | let v=MonthView() 210 | v.translatesAutoresizingMaskIntoConstraints=false 211 | return v 212 | }() 213 | 214 | let weekdaysView: WeekdaysView = { 215 | let v=WeekdaysView() 216 | v.translatesAutoresizingMaskIntoConstraints=false 217 | return v 218 | }() 219 | 220 | let myCollectionView: UICollectionView = { 221 | let layout = UICollectionViewFlowLayout() 222 | layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 223 | 224 | let myCollectionView=UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) 225 | myCollectionView.showsHorizontalScrollIndicator = false 226 | myCollectionView.translatesAutoresizingMaskIntoConstraints=false 227 | myCollectionView.backgroundColor=UIColor.clear 228 | myCollectionView.allowsMultipleSelection=false 229 | return myCollectionView 230 | }() 231 | 232 | required init?(coder aDecoder: NSCoder) { 233 | fatalError("init(coder:) has not been implemented") 234 | } 235 | } 236 | 237 | class dateCVCell: UICollectionViewCell { 238 | override init(frame: CGRect) { 239 | super.init(frame: frame) 240 | backgroundColor=UIColor.clear 241 | layer.cornerRadius=5 242 | layer.masksToBounds=true 243 | 244 | setupViews() 245 | } 246 | 247 | func setupViews() { 248 | addSubview(lbl) 249 | lbl.topAnchor.constraint(equalTo: topAnchor).isActive=true 250 | lbl.leftAnchor.constraint(equalTo: leftAnchor).isActive=true 251 | lbl.rightAnchor.constraint(equalTo: rightAnchor).isActive=true 252 | lbl.bottomAnchor.constraint(equalTo: bottomAnchor).isActive=true 253 | } 254 | 255 | let lbl: UILabel = { 256 | let label = UILabel() 257 | label.text = "00" 258 | label.textAlignment = .center 259 | label.font=UIFont.systemFont(ofSize: 16) 260 | label.textColor=Colors.darkGray 261 | label.translatesAutoresizingMaskIntoConstraints=false 262 | return label 263 | }() 264 | 265 | required init?(coder aDecoder: NSCoder) { 266 | fatalError("init(coder:) has not been implemented") 267 | } 268 | } 269 | 270 | //get first day of the month 271 | extension Date { 272 | var weekday: Int { 273 | return Calendar.current.component(.weekday, from: self) 274 | } 275 | var firstDayOfTheMonth: Date { 276 | return Calendar.current.date(from: Calendar.current.dateComponents([.year,.month], from: self))! 277 | } 278 | } 279 | 280 | //get date from string 281 | extension String { 282 | static var dateFormatter: DateFormatter = { 283 | let formatter = DateFormatter() 284 | formatter.dateFormat = "yyyy-MM-dd" 285 | return formatter 286 | }() 287 | 288 | var date: Date? { 289 | return String.dateFormatter.date(from: self) 290 | } 291 | } 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | -------------------------------------------------------------------------------- /myCalender2.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D92381B61F9C5CDE002FF5E0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92381B51F9C5CDE002FF5E0 /* AppDelegate.swift */; }; 11 | D92381B81F9C5CDE002FF5E0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92381B71F9C5CDE002FF5E0 /* ViewController.swift */; }; 12 | D92381BD1F9C5CDE002FF5E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D92381BC1F9C5CDE002FF5E0 /* Assets.xcassets */; }; 13 | D92381C01F9C5CDE002FF5E0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D92381BE1F9C5CDE002FF5E0 /* LaunchScreen.storyboard */; }; 14 | D92381C81F9C5D61002FF5E0 /* MonthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92381C71F9C5D61002FF5E0 /* MonthView.swift */; }; 15 | D92381CA1F9C5EC3002FF5E0 /* WeekdaysView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92381C91F9C5EC3002FF5E0 /* WeekdaysView.swift */; }; 16 | D92381CC1F9C5F68002FF5E0 /* CalenderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92381CB1F9C5F68002FF5E0 /* CalenderView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | D92381B21F9C5CDE002FF5E0 /* myCalender2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = myCalender2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | D92381B51F9C5CDE002FF5E0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | D92381B71F9C5CDE002FF5E0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | D92381BC1F9C5CDE002FF5E0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | D92381BF1F9C5CDE002FF5E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | D92381C11F9C5CDE002FF5E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | D92381C71F9C5D61002FF5E0 /* MonthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthView.swift; sourceTree = ""; }; 27 | D92381C91F9C5EC3002FF5E0 /* WeekdaysView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekdaysView.swift; sourceTree = ""; }; 28 | D92381CB1F9C5F68002FF5E0 /* CalenderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalenderView.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | D92381AF1F9C5CDE002FF5E0 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | D92381A91F9C5CDE002FF5E0 = { 43 | isa = PBXGroup; 44 | children = ( 45 | D92381B41F9C5CDE002FF5E0 /* myCalender2 */, 46 | D92381B31F9C5CDE002FF5E0 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | D92381B31F9C5CDE002FF5E0 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | D92381B21F9C5CDE002FF5E0 /* myCalender2.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | D92381B41F9C5CDE002FF5E0 /* myCalender2 */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | D92381B51F9C5CDE002FF5E0 /* AppDelegate.swift */, 62 | D92381B71F9C5CDE002FF5E0 /* ViewController.swift */, 63 | D92381C71F9C5D61002FF5E0 /* MonthView.swift */, 64 | D92381C91F9C5EC3002FF5E0 /* WeekdaysView.swift */, 65 | D92381CB1F9C5F68002FF5E0 /* CalenderView.swift */, 66 | D92381BC1F9C5CDE002FF5E0 /* Assets.xcassets */, 67 | D92381BE1F9C5CDE002FF5E0 /* LaunchScreen.storyboard */, 68 | D92381C11F9C5CDE002FF5E0 /* Info.plist */, 69 | ); 70 | path = myCalender2; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | D92381B11F9C5CDE002FF5E0 /* myCalender2 */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = D92381C41F9C5CDE002FF5E0 /* Build configuration list for PBXNativeTarget "myCalender2" */; 79 | buildPhases = ( 80 | D92381AE1F9C5CDE002FF5E0 /* Sources */, 81 | D92381AF1F9C5CDE002FF5E0 /* Frameworks */, 82 | D92381B01F9C5CDE002FF5E0 /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = myCalender2; 89 | productName = myCalender2; 90 | productReference = D92381B21F9C5CDE002FF5E0 /* myCalender2.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | D92381AA1F9C5CDE002FF5E0 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 0900; 100 | LastUpgradeCheck = 0900; 101 | ORGANIZATIONNAME = akhil; 102 | TargetAttributes = { 103 | D92381B11F9C5CDE002FF5E0 = { 104 | CreatedOnToolsVersion = 9.0; 105 | ProvisioningStyle = Automatic; 106 | }; 107 | }; 108 | }; 109 | buildConfigurationList = D92381AD1F9C5CDE002FF5E0 /* Build configuration list for PBXProject "myCalender2" */; 110 | compatibilityVersion = "Xcode 8.0"; 111 | developmentRegion = en; 112 | hasScannedForEncodings = 0; 113 | knownRegions = ( 114 | en, 115 | Base, 116 | ); 117 | mainGroup = D92381A91F9C5CDE002FF5E0; 118 | productRefGroup = D92381B31F9C5CDE002FF5E0 /* Products */; 119 | projectDirPath = ""; 120 | projectRoot = ""; 121 | targets = ( 122 | D92381B11F9C5CDE002FF5E0 /* myCalender2 */, 123 | ); 124 | }; 125 | /* End PBXProject section */ 126 | 127 | /* Begin PBXResourcesBuildPhase section */ 128 | D92381B01F9C5CDE002FF5E0 /* Resources */ = { 129 | isa = PBXResourcesBuildPhase; 130 | buildActionMask = 2147483647; 131 | files = ( 132 | D92381C01F9C5CDE002FF5E0 /* LaunchScreen.storyboard in Resources */, 133 | D92381BD1F9C5CDE002FF5E0 /* Assets.xcassets in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | D92381AE1F9C5CDE002FF5E0 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | D92381B81F9C5CDE002FF5E0 /* ViewController.swift in Sources */, 145 | D92381CA1F9C5EC3002FF5E0 /* WeekdaysView.swift in Sources */, 146 | D92381C81F9C5D61002FF5E0 /* MonthView.swift in Sources */, 147 | D92381CC1F9C5F68002FF5E0 /* CalenderView.swift in Sources */, 148 | D92381B61F9C5CDE002FF5E0 /* AppDelegate.swift in Sources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXSourcesBuildPhase section */ 153 | 154 | /* Begin PBXVariantGroup section */ 155 | D92381BE1F9C5CDE002FF5E0 /* LaunchScreen.storyboard */ = { 156 | isa = PBXVariantGroup; 157 | children = ( 158 | D92381BF1F9C5CDE002FF5E0 /* Base */, 159 | ); 160 | name = LaunchScreen.storyboard; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXVariantGroup section */ 164 | 165 | /* Begin XCBuildConfiguration section */ 166 | D92381C21F9C5CDE002FF5E0 /* Debug */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_ANALYZER_NONNULL = YES; 171 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 172 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 173 | CLANG_CXX_LIBRARY = "libc++"; 174 | CLANG_ENABLE_MODULES = YES; 175 | CLANG_ENABLE_OBJC_ARC = YES; 176 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 177 | CLANG_WARN_BOOL_CONVERSION = YES; 178 | CLANG_WARN_COMMA = YES; 179 | CLANG_WARN_CONSTANT_CONVERSION = YES; 180 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 181 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 182 | CLANG_WARN_EMPTY_BODY = YES; 183 | CLANG_WARN_ENUM_CONVERSION = YES; 184 | CLANG_WARN_INFINITE_RECURSION = YES; 185 | CLANG_WARN_INT_CONVERSION = YES; 186 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 187 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 188 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 189 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 190 | CLANG_WARN_STRICT_PROTOTYPES = YES; 191 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 192 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 193 | CLANG_WARN_UNREACHABLE_CODE = YES; 194 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 195 | CODE_SIGN_IDENTITY = "iPhone Developer"; 196 | COPY_PHASE_STRIP = NO; 197 | DEBUG_INFORMATION_FORMAT = dwarf; 198 | ENABLE_STRICT_OBJC_MSGSEND = YES; 199 | ENABLE_TESTABILITY = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu11; 201 | GCC_DYNAMIC_NO_PIC = NO; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | GCC_OPTIMIZATION_LEVEL = 0; 204 | GCC_PREPROCESSOR_DEFINITIONS = ( 205 | "DEBUG=1", 206 | "$(inherited)", 207 | ); 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 215 | MTL_ENABLE_DEBUG_INFO = YES; 216 | ONLY_ACTIVE_ARCH = YES; 217 | SDKROOT = iphoneos; 218 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 219 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 220 | }; 221 | name = Debug; 222 | }; 223 | D92381C31F9C5CDE002FF5E0 /* Release */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | ALWAYS_SEARCH_USER_PATHS = NO; 227 | CLANG_ANALYZER_NONNULL = YES; 228 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 229 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 230 | CLANG_CXX_LIBRARY = "libc++"; 231 | CLANG_ENABLE_MODULES = YES; 232 | CLANG_ENABLE_OBJC_ARC = YES; 233 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 234 | CLANG_WARN_BOOL_CONVERSION = YES; 235 | CLANG_WARN_COMMA = YES; 236 | CLANG_WARN_CONSTANT_CONVERSION = YES; 237 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 238 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 239 | CLANG_WARN_EMPTY_BODY = YES; 240 | CLANG_WARN_ENUM_CONVERSION = YES; 241 | CLANG_WARN_INFINITE_RECURSION = YES; 242 | CLANG_WARN_INT_CONVERSION = YES; 243 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 244 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 245 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 246 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 247 | CLANG_WARN_STRICT_PROTOTYPES = YES; 248 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 249 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 250 | CLANG_WARN_UNREACHABLE_CODE = YES; 251 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 252 | CODE_SIGN_IDENTITY = "iPhone Developer"; 253 | COPY_PHASE_STRIP = NO; 254 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 255 | ENABLE_NS_ASSERTIONS = NO; 256 | ENABLE_STRICT_OBJC_MSGSEND = YES; 257 | GCC_C_LANGUAGE_STANDARD = gnu11; 258 | GCC_NO_COMMON_BLOCKS = YES; 259 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 260 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 261 | GCC_WARN_UNDECLARED_SELECTOR = YES; 262 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 263 | GCC_WARN_UNUSED_FUNCTION = YES; 264 | GCC_WARN_UNUSED_VARIABLE = YES; 265 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 266 | MTL_ENABLE_DEBUG_INFO = NO; 267 | SDKROOT = iphoneos; 268 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 269 | VALIDATE_PRODUCT = YES; 270 | }; 271 | name = Release; 272 | }; 273 | D92381C51F9C5CDE002FF5E0 /* Debug */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 277 | CODE_SIGN_STYLE = Automatic; 278 | INFOPLIST_FILE = myCalender2/Info.plist; 279 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 280 | PRODUCT_BUNDLE_IDENTIFIER = com.akhil.myCalender2; 281 | PRODUCT_NAME = "$(TARGET_NAME)"; 282 | SWIFT_VERSION = 4.0; 283 | TARGETED_DEVICE_FAMILY = "1,2"; 284 | }; 285 | name = Debug; 286 | }; 287 | D92381C61F9C5CDE002FF5E0 /* Release */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CODE_SIGN_STYLE = Automatic; 292 | INFOPLIST_FILE = myCalender2/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.akhil.myCalender2; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_VERSION = 4.0; 297 | TARGETED_DEVICE_FAMILY = "1,2"; 298 | }; 299 | name = Release; 300 | }; 301 | /* End XCBuildConfiguration section */ 302 | 303 | /* Begin XCConfigurationList section */ 304 | D92381AD1F9C5CDE002FF5E0 /* Build configuration list for PBXProject "myCalender2" */ = { 305 | isa = XCConfigurationList; 306 | buildConfigurations = ( 307 | D92381C21F9C5CDE002FF5E0 /* Debug */, 308 | D92381C31F9C5CDE002FF5E0 /* Release */, 309 | ); 310 | defaultConfigurationIsVisible = 0; 311 | defaultConfigurationName = Release; 312 | }; 313 | D92381C41F9C5CDE002FF5E0 /* Build configuration list for PBXNativeTarget "myCalender2" */ = { 314 | isa = XCConfigurationList; 315 | buildConfigurations = ( 316 | D92381C51F9C5CDE002FF5E0 /* Debug */, 317 | D92381C61F9C5CDE002FF5E0 /* Release */, 318 | ); 319 | defaultConfigurationIsVisible = 0; 320 | defaultConfigurationName = Release; 321 | }; 322 | /* End XCConfigurationList section */ 323 | }; 324 | rootObject = D92381AA1F9C5CDE002FF5E0 /* Project object */; 325 | } 326 | --------------------------------------------------------------------------------