Skip to content

Commit

Permalink
Rename files to include "+Taylor"
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Dion committed Apr 1, 2016
1 parent 2ae7d4a commit 093447d
Show file tree
Hide file tree
Showing 15 changed files with 771 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -16,6 +16,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
*.xcworkspacedata

# CocoaPods
#
Expand Down
52 changes: 48 additions & 4 deletions Taylor.xcodeproj/project.pbxproj
Expand Up @@ -7,10 +7,21 @@
objects = {

/* Begin PBXBuildFile section */
7A3FC2B11CAC2ACC007A4063 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets.swift */; };
7A3FC2B11CAC2ACC007A4063 /* UIEdgeInsets+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets+Taylor.swift */; };
7A3FC2B31CAC2B0B007A4063 /* UIEdgeInsetsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3FC2B21CAC2B0B007A4063 /* UIEdgeInsetsTests.swift */; };
7A44D05C1C187E030063575B /* Taylor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A44D05B1C187E030063575B /* Taylor.h */; settings = {ATTRIBUTES = (Public, ); }; };
7A44D0631C187E030063575B /* Taylor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A44D0581C187E030063575B /* Taylor.framework */; };
DFBC07AD1CAC399700A7A665 /* CGRect+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC079F1CAC399700A7A665 /* CGRect+Taylor.swift */; };
DFBC07AE1CAC399700A7A665 /* CGSize+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A01CAC399700A7A665 /* CGSize+Taylor.swift */; };
DFBC07B01CAC399700A7A665 /* Double+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A21CAC399700A7A665 /* Double+Taylor.swift */; };
DFBC07B21CAC399700A7A665 /* NSDate+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A41CAC399700A7A665 /* NSDate+Taylor.swift */; };
DFBC07B31CAC399700A7A665 /* Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A51CAC399700A7A665 /* Time.swift */; };
DFBC07B41CAC399700A7A665 /* UIButton+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A61CAC399700A7A665 /* UIButton+Taylor.swift */; };
DFBC07B51CAC399700A7A665 /* UIColor+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A71CAC399700A7A665 /* UIColor+Taylor.swift */; };
DFBC07B61CAC399700A7A665 /* UIDevice+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A81CAC399700A7A665 /* UIDevice+Taylor.swift */; };
DFBC07B71CAC399700A7A665 /* UIImageView+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07A91CAC399700A7A665 /* UIImageView+Taylor.swift */; };
DFBC07B81CAC399700A7A665 /* UILabel+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07AA1CAC399700A7A665 /* UILabel+Taylor.swift */; };
DFBC07B91CAC399700A7A665 /* UIScreen+Taylor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFBC07AB1CAC399700A7A665 /* UIScreen+Taylor.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -24,13 +35,24 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIEdgeInsets.swift; sourceTree = "<group>"; };
7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIEdgeInsets+Taylor.swift"; sourceTree = "<group>"; };
7A3FC2B21CAC2B0B007A4063 /* UIEdgeInsetsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIEdgeInsetsTests.swift; sourceTree = "<group>"; };
7A44D0581C187E030063575B /* Taylor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Taylor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7A44D05B1C187E030063575B /* Taylor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Taylor.h; sourceTree = "<group>"; };
7A44D05D1C187E030063575B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7A44D0621C187E030063575B /* TaylorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TaylorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7A44D0691C187E030063575B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DFBC079F1CAC399700A7A665 /* CGRect+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGRect+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A01CAC399700A7A665 /* CGSize+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGSize+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A21CAC399700A7A665 /* Double+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Double+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A41CAC399700A7A665 /* NSDate+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSDate+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A51CAC399700A7A665 /* Time.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Time.swift; sourceTree = "<group>"; };
DFBC07A61CAC399700A7A665 /* UIButton+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A71CAC399700A7A665 /* UIColor+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A81CAC399700A7A665 /* UIDevice+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDevice+Taylor.swift"; sourceTree = "<group>"; };
DFBC07A91CAC399700A7A665 /* UIImageView+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+Taylor.swift"; sourceTree = "<group>"; };
DFBC07AA1CAC399700A7A665 /* UILabel+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+Taylor.swift"; sourceTree = "<group>"; };
DFBC07AB1CAC399700A7A665 /* UIScreen+Taylor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScreen+Taylor.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -73,9 +95,20 @@
7A44D05A1C187E030063575B /* Taylor */ = {
isa = PBXGroup;
children = (
DFBC079F1CAC399700A7A665 /* CGRect+Taylor.swift */,
DFBC07A01CAC399700A7A665 /* CGSize+Taylor.swift */,
DFBC07A21CAC399700A7A665 /* Double+Taylor.swift */,
DFBC07A41CAC399700A7A665 /* NSDate+Taylor.swift */,
DFBC07A51CAC399700A7A665 /* Time.swift */,
DFBC07A61CAC399700A7A665 /* UIButton+Taylor.swift */,
DFBC07A71CAC399700A7A665 /* UIColor+Taylor.swift */,
DFBC07A81CAC399700A7A665 /* UIDevice+Taylor.swift */,
7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets+Taylor.swift */,
DFBC07A91CAC399700A7A665 /* UIImageView+Taylor.swift */,
DFBC07AA1CAC399700A7A665 /* UILabel+Taylor.swift */,
DFBC07AB1CAC399700A7A665 /* UIScreen+Taylor.swift */,
7A44D05B1C187E030063575B /* Taylor.h */,
7A44D05D1C187E030063575B /* Info.plist */,
7A3FC2B01CAC2ACC007A4063 /* UIEdgeInsets.swift */,
);
path = Taylor;
sourceTree = "<group>";
Expand Down Expand Up @@ -197,7 +230,18 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7A3FC2B11CAC2ACC007A4063 /* UIEdgeInsets.swift in Sources */,
DFBC07B61CAC399700A7A665 /* UIDevice+Taylor.swift in Sources */,
7A3FC2B11CAC2ACC007A4063 /* UIEdgeInsets+Taylor.swift in Sources */,
DFBC07AE1CAC399700A7A665 /* CGSize+Taylor.swift in Sources */,
DFBC07B21CAC399700A7A665 /* NSDate+Taylor.swift in Sources */,
DFBC07AD1CAC399700A7A665 /* CGRect+Taylor.swift in Sources */,
DFBC07B01CAC399700A7A665 /* Double+Taylor.swift in Sources */,
DFBC07B81CAC399700A7A665 /* UILabel+Taylor.swift in Sources */,
DFBC07B41CAC399700A7A665 /* UIButton+Taylor.swift in Sources */,
DFBC07B31CAC399700A7A665 /* Time.swift in Sources */,
DFBC07B71CAC399700A7A665 /* UIImageView+Taylor.swift in Sources */,
DFBC07B91CAC399700A7A665 /* UIScreen+Taylor.swift in Sources */,
DFBC07B51CAC399700A7A665 /* UIColor+Taylor.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
72 changes: 72 additions & 0 deletions Taylor/CGRect+Taylor.swift
@@ -0,0 +1,72 @@
// Copyright (c) 2016, Mirego
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// - Neither the name of the Mirego nor the names of its contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

import Foundation


// swiftlint:disable variable_name

extension CGRect
{
var x: CGFloat {
set {
origin.x = newValue
}

get {
return origin.x
}
}

var y: CGFloat {
set {
origin.y = newValue
}

get {
return origin.y
}
}

var midX: CGFloat {
return x + width / 2
}

var midY: CGFloat {
return y + height / 2
}

var maxX: CGFloat {
return x + width
}

var maxY: CGFloat {
return y + height
}
}

// swiftlint:enable variable_name
47 changes: 47 additions & 0 deletions Taylor/CGSize+Taylor.swift
@@ -0,0 +1,47 @@
// Copyright (c) 2016, Mirego
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// - Neither the name of the Mirego nor the names of its contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

import Foundation


extension CGSize
{
func inset(xOffset: CGFloat, yOffset: CGFloat) -> CGSize
{
return CGSize(width: self.width + xOffset, height: self.height + yOffset)
}

func scale(xOffset: CGFloat, yOffset: CGFloat) -> CGSize
{
return CGSize(width: self.width * xOffset, height: self.height * yOffset)
}

static func minimalTapableSize() -> CGSize
{
return CGSize(width: 44, height: 44)
}
}
40 changes: 40 additions & 0 deletions Taylor/Double+Taylor.swift
@@ -0,0 +1,40 @@
// Copyright (c) 2016, Mirego
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// - Neither the name of the Mirego nor the names of its contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

import Foundation


// swiftlint:disable variable_name

extension Double
{
var f: CGFloat {
return CGFloat(self)
}
}

// swiftlint:enable variable_name
66 changes: 66 additions & 0 deletions Taylor/NSDate+Taylor.swift
@@ -0,0 +1,66 @@
// Copyright (c) 2016, Mirego
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// - Neither the name of the Mirego nor the names of its contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

import UIKit


extension NSDate
{
func isSameDay(anotherDate: NSDate)
{
NSCalendar.currentCalendar().isDate(self, equalToDate: anotherDate, toUnitGranularity: .Day)
}


func daysBetween(toDate toDate: NSDate) -> Int
{
let components = NSCalendar.currentCalendar().components(.Day, fromDate: self, toDate: toDate, options: [])
return components.day
}

func addDaysToDate(daysToAdd: Int) -> NSDate
{
return NSCalendar.currentCalendar().dateByAddingUnit(.Day, value: daysToAdd, toDate: self, options: [])!
}

func getStartOfTheWeek() -> NSDate
{
let calendar = NSCalendar.currentCalendar()
var startOfTheWeek: NSDate?
var interval = NSTimeInterval(0)

calendar.rangeOfUnit(.WeekOfMonth, startDate: &startOfTheWeek, interval: &interval, forDate: self)

return startOfTheWeek!
}

func getWeekDay() -> Int
{
let components = NSCalendar.currentCalendar().components(.Weekday, fromDate: self)
return components.weekday
}
}
42 changes: 42 additions & 0 deletions Taylor/Time.swift
@@ -0,0 +1,42 @@
// Copyright (c) 2016, Mirego
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// - Neither the name of the Mirego nor the names of its contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

import Foundation


/*
From http://stackoverflow.com/questions/24034544/dispatch-after-gcd-in-swift/24318861#24318861
Example use, switching light on after 2 seconds:
delay(2) {
println("📱👈 -> 💡")
light.switchOn()
}
*/
func delay(delay: Double, closure:()->()) {
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC)))
dispatch_after(time, dispatch_get_main_queue(), closure)
}

0 comments on commit 093447d

Please sign in to comment.