Skip to content

Commit

Permalink
Update for Swift 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jkolb committed Dec 17, 2015
1 parent 0e40460 commit dccfd34
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 65 deletions.
18 changes: 7 additions & 11 deletions DrapierLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@
E5323B8C1A9A38A400571CB2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0630;
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Justin Kolb";
TargetAttributes = {
E5323B941A9A38A400571CB2 = {
Expand Down Expand Up @@ -257,6 +258,7 @@
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -276,7 +278,6 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -316,7 +317,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -335,6 +335,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand All @@ -351,6 +352,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand All @@ -359,29 +361,23 @@
E5323BAF1A9A38A400571CB2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = DrapierLayoutTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
E5323BB01A9A38A400571CB2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = DrapierLayoutTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E5323B941A9A38A400571CB2"
BuildableName = "DrapierLayout.framework"
BlueprintName = "DrapierLayout"
ReferencedContainer = "container:DrapierLayout.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E5323B9F1A9A38A400571CB2"
BuildableName = "DrapierLayoutTests.xctest"
BlueprintName = "DrapierLayoutTests"
ReferencedContainer = "container:DrapierLayout.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E5323B941A9A38A400571CB2"
BuildableName = "DrapierLayout.framework"
BlueprintName = "DrapierLayout"
ReferencedContainer = "container:DrapierLayout.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E5323B941A9A38A400571CB2"
BuildableName = "DrapierLayout.framework"
BlueprintName = "DrapierLayout"
ReferencedContainer = "container:DrapierLayout.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E5323B941A9A38A400571CB2"
BuildableName = "DrapierLayout.framework"
BlueprintName = "DrapierLayout"
ReferencedContainer = "container:DrapierLayout.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
27 changes: 16 additions & 11 deletions DrapierLayout/DrapierLayout.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// Copyright (c) 2016 Justin Kolb - http://franticapparatus.net
//
// DrapierLayout.h
// DrapierLayout
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// Created by Justin Kolb on 2/22/15.
// Copyright (c) 2015 Justin Kolb. All rights reserved.
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

//! Project version number for DrapierLayout.
FOUNDATION_EXPORT double DrapierLayoutVersionNumber;

//! Project version string for DrapierLayout.
FOUNDATION_EXPORT const unsigned char DrapierLayoutVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <DrapierLayout/PublicHeader.h>


4 changes: 2 additions & 2 deletions DrapierLayout/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
21 changes: 8 additions & 13 deletions DrapierLayout/Layout.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//
// Layout.swift
// DrapierLayout
//
// Copyright (c) 2014 Justin Kolb - http://franticapparatus.net
// Copyright (c) 2016 Justin Kolb - http://franticapparatus.net
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,15 +17,14 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import UIKit

public let maximumLayoutValue = CGFloat(10_000.0)

public extension CGSize {
public func rect() -> CGRect {
return CGRect(origin: CGPoint.zeroPoint, size: self)
return CGRect(origin: CGPoint.zero, size: self)
}

public static func fixedWidth(width: CGFloat) -> CGSize {
Expand Down Expand Up @@ -130,27 +125,27 @@ public extension CGRect {
}
}

public func baseline(# descender: CGFloat) -> CGFloat {
public func baseline(descender descender: CGFloat) -> CGFloat {
return round(bottom + descender)
}

public func baseline(# font: UIFont) -> CGFloat {
public func baseline(font font: UIFont) -> CGFloat {
return baseline(descender: font.descender)
}

public func firstBaseline(# ascender: CGFloat) -> CGFloat {
public func firstBaseline(ascender ascender: CGFloat) -> CGFloat {
return round(top + ascender)
}

public func firstBaseline(# font: UIFont) -> CGFloat {
public func firstBaseline(font font: UIFont) -> CGFloat {
return firstBaseline(ascender: font.ascender)
}

public func capline(# ascender: CGFloat, capHeight: CGFloat) -> CGFloat {
public func capline(ascender ascender: CGFloat, capHeight: CGFloat) -> CGFloat {
return round(top + (ascender - capHeight))
}

public func capline(# font: UIFont) -> CGFloat {
public func capline(font font: UIFont) -> CGFloat {
return capline(ascender: font.ascender, capHeight: font.capHeight)
}

Expand Down
43 changes: 16 additions & 27 deletions DrapierLayoutTests/DrapierLayoutTests.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
// Copyright (c) 2016 Justin Kolb - http://franticapparatus.net
//
// DrapierLayoutTests.swift
// DrapierLayoutTests
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// Created by Justin Kolb on 10/30/14.
// Copyright (c) 2014 Justin Kolb. All rights reserved.
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import UIKit
import XCTest

class DrapierLayoutTests: XCTestCase {

override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}

}
2 changes: 1 addition & 1 deletion DrapierLayoutTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>net.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down

0 comments on commit dccfd34

Please sign in to comment.