Skip to content

Commit

Permalink
Merge pull request #38 from thachphat0/master
Browse files Browse the repository at this point in the history
convert to Swift 3
  • Loading branch information
ipraba authored Apr 14, 2017
2 parents 38f3f55 + 0d44781 commit 957a2e0
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 172 deletions.
13 changes: 12 additions & 1 deletion EPCalendar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@
F4C1C9B11BE7A305001AA643 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = "Prabaharan Elangovan";
TargetAttributes = {
F4C1C9B81BE7A305001AA643 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0820;
};
F4C1C9CC1BE7A306001AA643 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0820;
TestTargetID = F4C1C9B81BE7A305001AA643;
};
};
Expand Down Expand Up @@ -288,8 +290,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -333,8 +337,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -353,6 +359,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -366,6 +373,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prabaharan.epcalendar.EPCalendar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -377,6 +385,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prabaharan.epcalendar.EPCalendar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -388,6 +397,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prabaharan.epcalendar.EPCalendarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EPCalendar.app/EPCalendar";
};
name = Debug;
Expand All @@ -400,6 +410,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prabaharan.epcalendar.EPCalendarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EPCalendar.app/EPCalendar";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
12 changes: 6 additions & 6 deletions EPCalendar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// 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.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// 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.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// 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.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
18 changes: 9 additions & 9 deletions EPCalendar/EPCalendarPicker/EPCalendarCell1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ import UIKit

class EPCalendarCell1: UICollectionViewCell {

var currentDate: NSDate!
var currentDate: Date!
var isCellSelectable: Bool?

@IBOutlet weak var lblDay: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}

func selectedForLabelColor(color: UIColor) {
func selectedForLabelColor(_ color: UIColor) {
self.lblDay.layer.cornerRadius = self.lblDay.frame.size.width/2
self.lblDay.layer.backgroundColor = color.CGColor
self.lblDay.textColor = UIColor.whiteColor()
self.lblDay.layer.backgroundColor = color.cgColor
self.lblDay.textColor = UIColor.white
}

func deSelectedForLabelColor(color: UIColor) {
self.lblDay.layer.backgroundColor = UIColor.clearColor().CGColor
func deSelectedForLabelColor(_ color: UIColor) {
self.lblDay.layer.backgroundColor = UIColor.clear.cgColor
self.lblDay.textColor = color
}


func setTodayCellColor(backgroundColor: UIColor) {
func setTodayCellColor(_ backgroundColor: UIColor) {

self.lblDay.layer.cornerRadius = self.lblDay.frame.size.width/2
self.lblDay.layer.backgroundColor = backgroundColor.CGColor
self.lblDay.textColor = UIColor.whiteColor()
self.lblDay.layer.backgroundColor = backgroundColor.cgColor
self.lblDay.textColor = UIColor.white
}
}
6 changes: 3 additions & 3 deletions EPCalendar/EPCalendarPicker/EPCalendarConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ struct EPDefaults {
static let multiSelection = false

//Colors
static let dayDisabledTintColor = UIColor.lightGrayColor()
static let dayDisabledTintColor = UIColor.lightGray
static let weekdayTintColor = EPColors.EmeraldColor
static let weekendTintColor = EPColors.PomegranateColor
static let dateSelectionColor = EPColors.PeterRiverColor
static let monthTitleColor = EPColors.PumpkinColor
static let todayTintColor = EPColors.AmethystColor

static let tintColor = EPColors.PomegranateColor
static let barTintColor = UIColor.whiteColor()
static let barTintColor = UIColor.white

//HeaderSize
static let headerSize = CGSizeMake(100,60)
static let headerSize = CGSize(width: 100,height: 60)
}

struct EPColors{
Expand Down
12 changes: 6 additions & 6 deletions EPCalendar/EPCalendarPicker/EPCalendarHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class EPCalendarHeaderView: UICollectionReusableView {
override func awakeFromNib() {
super.awakeFromNib()

let calendar = NSCalendar.currentCalendar()
let calendar = Calendar.current
let weeksDayList = calendar.shortWeekdaySymbols

if NSCalendar.currentCalendar().firstWeekday == 2 {
if Calendar.current.firstWeekday == 2 {
lblFirst.text = weeksDayList[1]
lblSecond.text = weeksDayList[2]
lblThird.text = weeksDayList[3]
Expand All @@ -44,9 +44,9 @@ class EPCalendarHeaderView: UICollectionReusableView {
}
}

func updateWeekendLabelColor(color: UIColor)
func updateWeekendLabelColor(_ color: UIColor)
{
if NSCalendar.currentCalendar().firstWeekday == 2 {
if Calendar.current.firstWeekday == 2 {
lblSixth.textColor = color
lblSeventh.textColor = color
} else {
Expand All @@ -55,8 +55,8 @@ class EPCalendarHeaderView: UICollectionReusableView {
}
}

func updateWeekdaysLabelColor(color: UIColor) {
if NSCalendar.currentCalendar().firstWeekday == 2 {
func updateWeekdaysLabelColor(_ color: UIColor) {
if Calendar.current.firstWeekday == 2 {
lblFirst.textColor = color
lblSecond.textColor = color
lblThird.textColor = color
Expand Down
Loading

0 comments on commit 957a2e0

Please sign in to comment.