Skip to content

Commit

Permalink
Feature/swift 5 (#52)
Browse files Browse the repository at this point in the history
* Migrate to swift 5.0 and fix pbxproj new warnings

* Remove all warnings related to duplucate public keyword

* Update swift version

* Update travail xcode
  • Loading branch information
hugolefrancois committed May 2, 2019
1 parent 6d20988 commit 0945f0e
Show file tree
Hide file tree
Showing 26 changed files with 109 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .swift-version
@@ -1 +1 @@
4.0
5.0
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode10
osx_image: xcode10.2


before_install:
Expand All @@ -8,4 +8,3 @@ before_install:

script:
- set -o pipefail && bundle exec fastlane travis

8 changes: 4 additions & 4 deletions MRGTaylor.podspec
Expand Up @@ -8,17 +8,17 @@

Pod::Spec.new do |spec|
spec.name = "MRGTaylor"
spec.version = "1.5.0"
spec.version = "1.6.0"
spec.summary = "A short description of Taylor."
spec.homepage = "https://github.com/mirego/taylor-ios"
spec.license = "MIT"
spec.author = {
spec.author = {
"Mirego" => "it@irego.com"
}

spec.ios.deployment_target = '8.0'
spec.ios.deployment_target = '8.0'
spec.tvos.deployment_target = '9.0'
spec.swift_version = '4.2'
spec.swift_version = '5.0'

spec.source = { :git => "https://github.com/mirego/taylor-ios.git", :tag => "#{spec.version}" }
spec.source_files = "Taylor/**/*.swift"
Expand Down
23 changes: 13 additions & 10 deletions Taylor.xcodeproj/project.pbxproj
Expand Up @@ -336,16 +336,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Mirego;
TargetAttributes = {
7A44D0571C187E030063575B = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
7A44D0611C187E030063575B = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
DF14FD8E20C18B2B00C5784B = {
CreatedOnToolsVersion = 9.4;
Expand All @@ -355,10 +355,11 @@
};
buildConfigurationList = 7A44D0521C187E030063575B /* Build configuration list for PBXProject "Taylor" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7A44D04E1C187E030063575B;
productRefGroup = 7A44D0591C187E030063575B /* Products */;
Expand Down Expand Up @@ -485,6 +486,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -534,7 +536,7 @@
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -545,6 +547,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -586,7 +589,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -611,7 +614,7 @@
PRODUCT_NAME = Taylor;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -632,7 +635,7 @@
PRODUCT_NAME = Taylor;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -645,7 +648,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mirego.TaylorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -658,7 +661,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mirego.TaylorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
14 changes: 7 additions & 7 deletions Taylor/Date/NSDate.swift
Expand Up @@ -36,7 +36,7 @@ public extension Date
- returns: Returns true if the date mathches the specified date's day
*/
public func isSameDay(_ anotherDate: Date) -> Bool
func isSameDay(_ anotherDate: Date) -> Bool
{
return isEqual(to: anotherDate, unitGranularity: .day)
}
Expand All @@ -49,7 +49,7 @@ public extension Date
- returns: Returns true if the date is equal to the specified date using the specified NSCalendarUnit
*/
public func isEqual(to toDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
func isEqual(to toDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
{
return (Calendar.current as NSCalendar).compare(self, to: toDate, toUnitGranularity: unitGranularity) == ComparisonResult.orderedSame
}
Expand All @@ -62,7 +62,7 @@ public extension Date
- returns: Returns true if the date is earlier than the specified date using the specified NSCalendarUnit
*/
public func isEarlier(than thanDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
func isEarlier(than thanDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
{
return (Calendar.current as NSCalendar).compare(self, to: thanDate, toUnitGranularity: unitGranularity) == ComparisonResult.orderedAscending
}
Expand All @@ -75,23 +75,23 @@ public extension Date
- returns: Returns true if the date is later than the specified date using the specified NSCalendarUnit
*/
public func isLater(than thanDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
func isLater(than thanDate: Date, unitGranularity: NSCalendar.Unit = .second) -> Bool
{
return (Calendar.current as NSCalendar).compare(self, to: thanDate, toUnitGranularity: unitGranularity) == ComparisonResult.orderedDescending
}

public func daysBetween(toDate: Date) -> Int
func daysBetween(toDate: Date) -> Int
{
let components = (Calendar.current as NSCalendar).components(.day, from: self, to: toDate, options: [])
return components.day!
}

public func addDaysToDate(_ daysToAdd: Int) -> Date
func addDaysToDate(_ daysToAdd: Int) -> Date
{
return (Calendar.current as NSCalendar).date(byAdding: .day, value: daysToAdd, to: self, options: [])!
}

public func getWeekDay() -> Int
func getWeekDay() -> Int
{
let components = (Calendar.current as NSCalendar).components(.weekday, from: self)
return components.weekday!
Expand Down
12 changes: 6 additions & 6 deletions Taylor/Geometry/CGPoint.swift
Expand Up @@ -37,30 +37,30 @@ func += (left: inout CGPoint, right: CGPoint) {

public extension CGPoint
{
public mutating func round() {
mutating func round() {
x = Darwin.round(x)
y = Darwin.round(y)
}

public func rounded() -> CGPoint {
func rounded() -> CGPoint {
return CGPoint(x: Darwin.round(x), y: Darwin.round(y))
}

public mutating func floor() {
mutating func floor() {
x = Darwin.floor(x)
y = Darwin.floor(y)
}

public func floored() -> CGPoint {
func floored() -> CGPoint {
return CGPoint(x: Darwin.floor(x), y: Darwin.floor(y))
}

public mutating func ceil() {
mutating func ceil() {
x = Darwin.ceil(x)
y = Darwin.ceil(y)
}

public func ceiled() -> CGPoint {
func ceiled() -> CGPoint {
return CGPoint(x: Darwin.ceil(x), y: Darwin.ceil(y))
}
}
4 changes: 2 additions & 2 deletions Taylor/Geometry/CGRect.swift
Expand Up @@ -32,7 +32,7 @@ import Foundation
public extension CGRect
{
/// Expose the x origin of the `CGRect`
public var x: CGFloat {
var x: CGFloat {
set {
origin.x = newValue
}
Expand All @@ -43,7 +43,7 @@ public extension CGRect
}

/// Expose the y origin of the `CGRect`
public var y: CGFloat {
var y: CGFloat {
set {
origin.y = newValue
}
Expand Down
20 changes: 10 additions & 10 deletions Taylor/Geometry/CGSize.swift
Expand Up @@ -38,47 +38,47 @@ func += (left: inout CGSize, right: CGSize) {
public extension CGSize
{
@available(*, deprecated, message: "This function was not performing an inset operation but had the effect of adding values to its components, you should use the + operator on two CGSize as a direct replacement. To perform a real inset operation, use insetBy provided by CoreGraphics.")
public func inset(_ xOffset: CGFloat, yOffset: CGFloat) -> CGSize {
func inset(_ xOffset: CGFloat, yOffset: CGFloat) -> CGSize {
return CGSize(width: self.width + xOffset, height: self.height + yOffset)
}

@available(*, deprecated, message: "Use scaleBy instead of this function, its naming is more in line with naming conventions.")
public func scale(_ xOffset: CGFloat, yOffset: CGFloat) -> CGSize {
func scale(_ xOffset: CGFloat, yOffset: CGFloat) -> CGSize {
return CGSize(width: self.width * xOffset, height: self.height * yOffset)
}

public func scaleBy(sx: CGFloat, sy: CGFloat) -> CGSize {
func scaleBy(sx: CGFloat, sy: CGFloat) -> CGSize {
return CGSize(width: self.width * sx, height: self.height * sy)
}

public mutating func round() {
mutating func round() {
width = Darwin.round(width)
height = Darwin.round(height)
}

public func rounded() -> CGSize {
func rounded() -> CGSize {
return CGSize(width: Darwin.round(width), height: Darwin.round(height))
}

public mutating func floor() {
mutating func floor() {
width = Darwin.floor(width)
height = Darwin.floor(height)
}

public func floored() -> CGSize {
func floored() -> CGSize {
return CGSize(width: Darwin.floor(width), height: Darwin.floor(height))
}

public mutating func ceil() {
mutating func ceil() {
width = Darwin.ceil(width)
height = Darwin.ceil(height)
}

public func ceiled() -> CGSize {
func ceiled() -> CGSize {
return CGSize(width: Darwin.ceil(width), height: Darwin.ceil(height))
}

static public func minimalTapableSize() -> CGSize {
static func minimalTapableSize() -> CGSize {
return CGSize(width: 44, height: 44)
}
}
2 changes: 1 addition & 1 deletion Taylor/Types/CGFloat.swift
Expand Up @@ -31,7 +31,7 @@ import Foundation

public extension CGFloat
{
public static var max = CGFloat.greatestFiniteMagnitude
static var max = CGFloat.greatestFiniteMagnitude
}

// swiftlint:enable variable_name
2 changes: 1 addition & 1 deletion Taylor/Types/Double.swift
Expand Up @@ -39,7 +39,7 @@ public extension Double
///
/// let padding = 10.f
/// ```
public var f: CGFloat {
var f: CGFloat {
return CGFloat(self)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Taylor/Types/Int.swift
Expand Up @@ -39,7 +39,7 @@ public extension Int
///
/// let padding = 10.f
/// ```
public var f: CGFloat {
var f: CGFloat {
return CGFloat(self)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Taylor/Types/String.swift
Expand Up @@ -33,7 +33,7 @@ public extension String
/// parameter regExp: Regular expression
/// parameter caseSensitive: Specify if the comparison must be case sensitive (Default is true).
/// returns: true if the string matches the specified regular expression
public func matches(_ regExp: String, caseSensitive: Bool = true) -> Bool
func matches(_ regExp: String, caseSensitive: Bool = true) -> Bool
{
do {
let regex = try NSRegularExpression(pattern:regExp, options: caseSensitive ? [] : .caseInsensitive)
Expand All @@ -45,7 +45,7 @@ public extension String

/// Checks if the string contains a valid email address.
/// returns: true if valid
public func isEmailAddress() -> Bool
func isEmailAddress() -> Bool
{
return matches("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,63}$")
}
Expand Down

0 comments on commit 0945f0e

Please sign in to comment.