├── .gitignore ├── APSwiftHelpersTests ├── Printable.swift ├── DebugLoggingTests.swift ├── PlistStub.swift ├── NSLocale+HelpersTests.swift ├── NSCoding+HelpersTests.swift ├── Note.swift ├── Info.plist ├── CATransaction+HelpersTests.swift ├── AppTests.swift └── DispatchTests.swift ├── APSwiftHelpers.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── alex.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── alex.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── xcshareddata │ └── xcschemes │ │ └── APSwiftHelpers.xcscheme └── project.pbxproj ├── .travis.yml ├── APSwiftHelpers ├── APSwiftHelpers.h ├── NSLocale+Helpers.swift ├── CATransaction+Helpers.swift ├── NSCoding+Helpers.swift ├── DebugLogging.swift ├── Info.plist ├── App.swift └── Dispatch.swift ├── APSwiftHelpers.podspec ├── install_swiftlint.sh ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/Printable.swift: -------------------------------------------------------------------------------- 1 | struct Printable: CustomDebugStringConvertible { 2 | var debugDescription: String { 3 | get { return "Hey!" } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /APSwiftHelpers.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode7.2 3 | 4 | before_install: 5 | - ./install_swiftlint.sh 6 | 7 | script: 8 | - swiftlint 9 | - xctool test -project APSwiftHelpers.xcodeproj -scheme APSwiftHelpers -sdk iphonesimulator 10 | -------------------------------------------------------------------------------- /APSwiftHelpers.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexpls/APSwiftHelpers/HEAD/APSwiftHelpers.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /APSwiftHelpersTests/DebugLoggingTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class DebugLoggingTests: XCTestCase { 4 | 5 | func testDebugLogFormat() { 6 | let printable = Printable() 7 | let formatted = debugLogFormatMessage(printable, message: "Let's go") 8 | XCTAssertEqual(formatted, "(Hey!) Let's go") 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/PlistStub.swift: -------------------------------------------------------------------------------- 1 | struct PlistStub: PlistProvider { 2 | func objectForInfoDictionaryKey(key: String) -> AnyObject? { 3 | switch key { 4 | case "CFBundleDisplayName": 5 | return "APSwiftHelpersTests" 6 | case "CFBundleShortVersionString": 7 | return "1.1" 8 | default: 9 | return nil 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/NSLocale+HelpersTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class NSLocaleHelpersTests: XCTestCase { 4 | 5 | private let usLocale = NSLocale(localeIdentifier: "en_US") 6 | 7 | func testGetLocaleCountryCode() { 8 | XCTAssertEqual(usLocale.countryCode, "US") 9 | } 10 | 11 | func testGetLocaleCountryName() { 12 | XCTAssertEqual(usLocale.countryName, "United States") 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /APSwiftHelpers/APSwiftHelpers.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for APSwiftHelpers. 4 | FOUNDATION_EXPORT double APSwiftHelpersVersionNumber; 5 | 6 | //! Project version string for APSwiftHelpers. 7 | FOUNDATION_EXPORT const unsigned char APSwiftHelpersVersionString[]; 8 | 9 | // In this header, you should import all the public headers of your framework using statements like #import 10 | 11 | 12 | -------------------------------------------------------------------------------- /APSwiftHelpers/NSLocale+Helpers.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension NSLocale { 4 | 5 | /// The country code for this locale. An example could be `US`. 6 | public var countryCode: String? { 7 | return objectForKey(NSLocaleCountryCode) as? String 8 | } 9 | 10 | /// The country name for this locale. An example could be `United States`. 11 | public var countryName: String? { 12 | guard let countryCode = countryCode else { return nil } 13 | return displayNameForKey(NSLocaleCountryCode, value: countryCode) 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/NSCoding+HelpersTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import Foundation 4 | 5 | class NSCodingHelpersTests: XCTestCase { 6 | 7 | func testCanArchiveAndUnarchiveNSCoding() { 8 | let note = Note(title: "secret", content: "i like turtles") 9 | let archivedData = note.archive() 10 | 11 | guard let note2 = Note.unarchive(archivedData) else { 12 | XCTAssert(false, "could not unarchive NSCoder") 13 | return 14 | } 15 | 16 | XCTAssertEqual(note.title, note2.title) 17 | XCTAssertEqual(note.content, note2.content) 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /APSwiftHelpers/CATransaction+Helpers.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import QuartzCore 3 | 4 | /** 5 | Wrap the given block in a CATransaction with animations disabled (or 6 | enabled if optional arg passed in). 7 | 8 | - Parameter disabled: Whether to disable CAAnimations within the given block or not 9 | - Parameter closure: The block to execute 10 | */ 11 | public func withCAAnimationsDisabled(disabled: Bool = true, closure: () -> Void) { 12 | CATransaction.begin() 13 | let cfBool = disabled ? kCFBooleanTrue : kCFBooleanFalse 14 | CATransaction.setValue(cfBool, forKey: kCATransactionDisableActions) 15 | closure() 16 | CATransaction.commit() 17 | } 18 | -------------------------------------------------------------------------------- /APSwiftHelpers.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "APSwiftHelpers" 3 | s.version = "0.0.2" 4 | s.summary = "Helper functions for developing Swift Cocoa Touch apps" 5 | s.description = "Helper functions for developing Swift Cocoa Touch apps" 6 | s.homepage = "https://github.com/alexpls/APSwiftHelpers" 7 | s.license = "MIT" 8 | s.license = { :type => "MIT", :file => "LICENSE.md" } 9 | s.author = { "Alex Plescan" => "alex@alexplescan.com" } 10 | s.platform = :ios, "9.0" 11 | s.source = { :git => "https://github.com/alexpls/APSwiftHelpers.git", :tag => "0.0.2" } 12 | s.source_files = "APSwiftHelpers/*.swift" 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /APSwiftHelpers/NSCoding+Helpers.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension NSCoding { 4 | /** 5 | Archive this object to NSData using NSKeyedArchiver. 6 | 7 | - Returns: The archived `NSData` 8 | */ 9 | public func archive() -> NSData { 10 | return NSKeyedArchiver.archivedDataWithRootObject(self) 11 | } 12 | 13 | /** 14 | Create a new instance of this object from the archived data passed in. 15 | 16 | - Parameter data: The data to unarchive (can be created using the `archive()` function) 17 | - Returns: Unarchived NSCoding instance 18 | */ 19 | public static func unarchive(data: NSData) -> Self? { 20 | return NSKeyedUnarchiver.unarchiveObjectWithData(data) as? Self 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /APSwiftHelpers.xcodeproj/xcuserdata/alex.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | APSwiftHelpers.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FA17A7541C76E436005D730B 16 | 17 | primary 18 | 19 | 20 | FA17A75E1C76E436005D730B 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /install_swiftlint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Installs the SwiftLint package. 4 | # Tries to get the precompiled .pkg file from Github, but if that 5 | # fails just recompiles from source. 6 | 7 | set -e 8 | 9 | SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg" 10 | 11 | wget --output-document=$SWIFTLINT_PKG_PATH https://github.com/realm/SwiftLint/releases/download/0.9.1/SwiftLint.pkg 12 | 13 | if [ -f $SWIFTLINT_PKG_PATH ]; then 14 | echo "SwiftLint package exists! Installing it..." 15 | sudo installer -pkg $SWIFTLINT_PKG_PATH -target / 16 | else 17 | echo "SwiftLint package doesn't exist. Compiling from source..." && 18 | git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint && 19 | cd /tmp/SwiftLint && 20 | git submodule update --init --recursive && 21 | sudo make install 22 | fi 23 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/Note.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class Note: NSObject, NSCoding { 4 | let title: String 5 | let content: String 6 | 7 | init(title: String, content: String) { 8 | self.title = title 9 | self.content = content 10 | } 11 | 12 | // MARK: - NSCoding 13 | 14 | required convenience init?(coder aDecoder: NSCoder) { 15 | guard let title = aDecoder.decodeObjectForKey("title") as? String, 16 | let content = aDecoder.decodeObjectForKey("content") as? String else { 17 | return nil 18 | } 19 | 20 | self.init(title: title, content: content) 21 | } 22 | 23 | func encodeWithCoder(aCoder: NSCoder) { 24 | aCoder.encodeObject(title, forKey: "title") 25 | aCoder.encodeObject(content, forKey: "content") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /APSwiftHelpers/DebugLogging.swift: -------------------------------------------------------------------------------- 1 | /** 2 | Prints a log message prefixed by the debugDescription of the passed in item. 3 | 4 | Note: passed in item must comply to CustomDebugStringConvertible and provide 5 | a debugDescription. 6 | 7 | *Example usage:* 8 | ``` 9 | debugLog(movie, "fetching poster from server") 10 | ``` 11 | 12 | - Parameter item: The CustomDebugStringConvertible item 13 | - Parameter message: The additional message to suffix the debugDescription of `item` 14 | */ 15 | public func debugLog(item: T, message: String) { 16 | print(debugLogFormatMessage(item, message: message)) 17 | } 18 | 19 | // swiftlint:disable:next line_length 20 | internal func debugLogFormatMessage(item: T, message: String) -> String { 21 | return "(\(item.debugDescription)) \(message)" 22 | } 23 | -------------------------------------------------------------------------------- /APSwiftHelpers/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2016 Alex Plescan 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/CATransaction+HelpersTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class CATransactionHelpersTests: XCTestCase { 4 | 5 | func testExecutesBlockWithoutCAAnimation() { 6 | withCAAnimationsDisabled(true) { 7 | // swiftlint:disable:next force_cast 8 | let val = CATransaction.valueForKey(kCATransactionDisableActions) as! CFBoolean 9 | XCTAssert(val == kCFBooleanTrue) 10 | } 11 | } 12 | 13 | func testExecutesBlockWithCAAnmiation() { 14 | withCAAnimationsDisabled(false) { 15 | // swiftlint:disable:next force_cast 16 | let val = CATransaction.valueForKey(kCATransactionDisableActions) as! CFBoolean 17 | XCTAssert(val == kCFBooleanFalse) 18 | } 19 | } 20 | 21 | func testDefaultsToExecutingWithoutCAAnimation() { 22 | withCAAnimationsDisabled { 23 | // swiftlint:disable:next force_cast 24 | let val = CATransaction.valueForKey(kCATransactionDisableActions) as! CFBoolean 25 | XCTAssert(val == kCFBooleanTrue) 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/AppTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class AppTests: XCTestCase { 4 | 5 | var initialPlistProvier: PlistProvider? 6 | 7 | override func setUp() { 8 | super.setUp() 9 | initialPlistProvier = App.plistProvider 10 | App.plistProvider = PlistStub() 11 | } 12 | 13 | override func tearDown() { 14 | super.tearDown() 15 | if let provider = initialPlistProvier { 16 | App.plistProvider = provider 17 | } 18 | } 19 | 20 | func testKnowsWhenAppIsRunningInSimulator() { 21 | let inSim = App.inSimulator 22 | XCTAssertEqual(inSim, (TARGET_IPHONE_SIMULATOR == 1)) 23 | } 24 | 25 | func testReturnsNameOfApplication() { 26 | if let name = App.name { 27 | XCTAssertEqual(name, "APSwiftHelpersTests") 28 | } else { 29 | XCTAssert(false, "expected to get name of application") 30 | } 31 | } 32 | 33 | func testReturnsVersionOfApplication() { 34 | if let version = App.version { 35 | XCTAssertEqual(version, "1.1") 36 | } else { 37 | XCTAssert(false, "expected to get version of application") 38 | } 39 | } 40 | 41 | func testReturnsFormattedNameAndVersionOfApplication() { 42 | if let formatted = App.formattedNameAndVersion { 43 | XCTAssertEqual(formatted, "APSwiftHelpersTests (1.1)") 44 | } else { 45 | XCTAssert(false, "expected to get formatted name and version") 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /APSwiftHelpers/App.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | Contains values about the currently running application. This struct should not 5 | need to be initialized directly. 6 | */ 7 | public struct App { 8 | /// Specifies whether the app is running within the iPhone 9 | /// simulator or not. 10 | public static var inSimulator: Bool { 11 | return (TARGET_IPHONE_SIMULATOR != 0) 12 | } 13 | 14 | /** 15 | Specifies whether the app is running in a Debug configuration. 16 | - Returns: Bool whether the app is running in simulator 17 | */ 18 | public static var isDebug: Bool { 19 | return _isDebugAssertConfiguration() 20 | } 21 | 22 | /// Get the name of the currently running application 23 | public static var name: String? { 24 | return getFromInfo("CFBundleDisplayName") 25 | } 26 | 27 | /// Get the version of the currently running application 28 | public static var version: String? { 29 | return getFromInfo("CFBundleShortVersionString") 30 | } 31 | 32 | /** 33 | Get a formatted name and version for the running application 34 | in this format: `MyApp (1.1)`. 35 | */ 36 | public static var formattedNameAndVersion: String? { 37 | if let name = App.name, let ver = App.version { 38 | return "\(name) (\(ver))" 39 | } else { 40 | return nil 41 | } 42 | } 43 | 44 | /// Internal protocol used for stubbing out NSBundle behaviour 45 | internal static var plistProvider: PlistProvider = NSBundle.mainBundle() 46 | 47 | /** 48 | Get info from the bundle's plist for a specific key 49 | - Parameter key: The key to look up 50 | - Returns: A value from the bundle's plist 51 | */ 52 | private static func getFromInfo(key: String) -> String? { 53 | return plistProvider.objectForInfoDictionaryKey(key) as? String 54 | } 55 | } 56 | 57 | protocol PlistProvider { 58 | func objectForInfoDictionaryKey(key: String) -> AnyObject? 59 | } 60 | 61 | extension NSBundle: PlistProvider {} 62 | -------------------------------------------------------------------------------- /APSwiftHelpers/Dispatch.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | Perform a block on the specified queue. This is just a nicer wrapper around the dispatch_async() 5 | Grand Central Dispatch function. 6 | 7 | - Parameter queueType: The queue to execute the block on 8 | - Parameter closure: The block to execute 9 | 10 | *Example usage:* 11 | ``` 12 | performOn(.Main) { self.tableView.reloadData() } 13 | ``` 14 | */ 15 | public func performOn(queueType: QueueType, closure: () -> Void) { 16 | dispatch_async(queueType.queue, closure) 17 | } 18 | 19 | /** 20 | Perform a block on a queue after waiting the specified time. 21 | 22 | - Parameter delay: Time to wait in seconds before performing the block 23 | - Parameter queueType: Queue to execute the block on (default is the main queue) 24 | - Parameter closure: Block to execute after the time specified in delay has passed 25 | 26 | *Example usage:* 27 | ``` 28 | // Wait for 200ms then run the block on the main queue 29 | delay(0.2) { alert.hide() } 30 | 31 | // Wait for 1s then run the block on a background queue 32 | delay(1.0, queueType: .Background) { alert.hide() } 33 | ``` 34 | */ 35 | public func delay(delay: NSTimeInterval, queueType: QueueType = .Main, closure: () -> Void) { 36 | let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))) 37 | dispatch_after(time, queueType.queue, closure) 38 | } 39 | 40 | /** 41 | A wrapper around GCD queues. This shouldn't be accessed directly, but rather through 42 | the helper functions supplied by the APSwiftHelpers package. 43 | */ 44 | public enum QueueType { 45 | case Main 46 | case Background 47 | case LowPriority 48 | case HighPriority 49 | 50 | var queue: dispatch_queue_t { 51 | switch self { 52 | case .Main: 53 | return dispatch_get_main_queue() 54 | case .Background: 55 | return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0) 56 | case .LowPriority: 57 | return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0) 58 | case .HighPriority: 59 | return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0) 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /APSwiftHelpersTests/DispatchTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class DispatchTests: XCTestCase { 4 | 5 | func testPerformBlockOnMainThread() { 6 | let expectation = expectationWithDescription("run on main thread") 7 | 8 | performOn(.Main) { 9 | XCTAssert(NSThread.isMainThread(), "should be on main thread") 10 | expectation.fulfill() 11 | } 12 | 13 | waitForExpectationsWithTimeout(1.0, handler: nil) 14 | } 15 | 16 | func testPerformBlockOnBackgroundThread() { 17 | let expectation = expectationWithDescription("run off main thread") 18 | 19 | performOn(.Background) { 20 | XCTAssert(!NSThread.isMainThread(), "should not be on main thread") 21 | expectation.fulfill() 22 | } 23 | 24 | waitForExpectationsWithTimeout(1.0, handler: nil) 25 | } 26 | 27 | func testDelayPerformsBlockOnMainThreadByDefault() { 28 | let expectation = expectationWithDescription("run on main thread") 29 | delay(0.1) { 30 | XCTAssert(NSThread.isMainThread(), "should be on main thread") 31 | expectation.fulfill() 32 | } 33 | waitForExpectationsWithTimeout(1.0, handler: nil) 34 | } 35 | 36 | func testDelayPerformsBlockOffMainThread() { 37 | let expectation = expectationWithDescription("run off main thread") 38 | delay(0.1, queueType: .Background) { 39 | XCTAssert(!NSThread.isMainThread(), "should be off main thread") 40 | expectation.fulfill() 41 | } 42 | waitForExpectationsWithTimeout(1, handler: nil) 43 | } 44 | 45 | func testDelayPerformsBlockAfterSpecifiedInterval() { 46 | let expectation = expectationWithDescription("perform block after specified interaval") 47 | 48 | let delayTime = 0.2 49 | let timeBeforeDelay = NSDate() 50 | 51 | delay(delayTime) { 52 | let timeAfterDelay = NSDate() 53 | let timeDiff = abs(timeAfterDelay.timeIntervalSinceDate(timeBeforeDelay)) 54 | let inTime = (timeDiff - delayTime) < 0.1 55 | XCTAssert(inTime, "should wait the specified amount of time before performing a block") 56 | expectation.fulfill() 57 | } 58 | 59 | waitForExpectationsWithTimeout(1, handler: nil) 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # APSwiftHelpers 2 | [![CocoaPods](https://img.shields.io/cocoapods/v/APSwiftHelpers.svg)](https://cocoapods.org/pods/APSwiftHelpers) [![Build Status](https://travis-ci.org/alexpls/APSwiftHelpers.svg?branch=master)](https://travis-ci.org/alexpls/APSwiftHelpers) 3 | 4 | Common helpers for developing iOS apps in Swift. Find them helpful? Help yourself. 5 | 6 | ## Deprecation notice and Swift 3 support 7 | 8 | When I wrote these helpers Swift 3 had not yet been released. Since then, a lot of the native Swift APIs have been improved in such a way that the syntactical sugar these helpers provided is no longer necessary. 9 | 10 | Because of this I will no longer be maintaining this library. If you have a particular use-case for these helpers and want to see them updated for Swift 3, open an issue and let me know. 11 | 12 | ## Installation 13 | 14 | ### [CocoaPods](https://cocoapods.org) 15 | 16 | 1. Add (or create) a Podfile containing this: 17 | ``` 18 | use_frameworks! 19 | pod 'APSwiftHelpers' 20 | ``` 21 | 22 | 2. Run `pod install`. 23 | 3. Done! 24 | 25 | ## Usage 26 | 27 | ### Dispatch 28 | Helpers for working with Grand Central Dispatch queues. 29 | 30 | ```swift 31 | // Perform a block on the given queue 32 | performOn(.Main) { self.tableView.reloadData() } 33 | performOn(.LowPriority) { self.clearCache() } 34 | 35 | // Delay a block on the given queue - if no queue is provided .Main is assumed 36 | delay(0.5) { self.hideSpinner() } 37 | delay(30, .Background) { self.logActivity() } 38 | 39 | // Queue types available: 40 | enum QueueType { 41 | case Main // The app's main queue 42 | case Background // Background queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND) 43 | case LowPriority // Background queue (DISPATCH_QUEUE_PRIORITY_LOW) 44 | case HighPriority // Background queue (DISPATCH_QUEUE_PRIORITY_HIGH) 45 | } 46 | ``` 47 | 48 | ### NSCoding+Helpers 49 | Extension to NSCoding to make it more Swift-y. 50 | ```swift 51 | // Archive an NSCoding to NSData 52 | let note = Note(title: "secret", content: "I like turtles") 53 | let archivedData = note.archive() 54 | 55 | // Unarchive NSData into an NSCoding object 56 | let unarchivedNote = Note.unarchive(archivedData) 57 | unarchivedNote.content // "I like turtles" 58 | ``` 59 | 60 | ### CATransaction+Helpers 61 | ```swift 62 | // Run the given block with CAAnimations disabled 63 | withCAAnimationsDisabled { self.view.resize() } 64 | ``` 65 | 66 | ### NSLocale+Helpers 67 | ```swift 68 | // Fetch region info from NSLocale: 69 | NSLocale.currentLocale().countryCode // String e.g.: "US" 70 | NSLocale.currentLocale().countryName // String e.g.: "United States" 71 | ``` 72 | 73 | ### App 74 | ```swift 75 | // Get info about the currently running app (taken from the 76 | // main bundle's) Info.plist file 77 | App.name 78 | App.version 79 | App.formattedNameAndVersion 80 | 81 | // Returns true/false whether the app running within the simulator or not 82 | App.inSimulator 83 | 84 | // Returns true/false whether the app is running in DEBUG mode 85 | App.isDebug 86 | ``` 87 | 88 | ### DebugLogging 89 | ```swift 90 | // Print a formatted log message for a CustomDebugStringConvertible 91 | 92 | struct Animal: CustomDebugStringConvertible { 93 | let name: String 94 | var debugDescription: String { return name } 95 | } 96 | 97 | let dog = Animal(name: "Woofy") 98 | debugLog(dog, "is tired") // prints "(Woofy) is tired" to the console 99 | ``` 100 | -------------------------------------------------------------------------------- /APSwiftHelpers.xcodeproj/xcshareddata/xcschemes/APSwiftHelpers.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /APSwiftHelpers.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FA17A7591C76E436005D730B /* APSwiftHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = FA17A7581C76E436005D730B /* APSwiftHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | FA17A7601C76E436005D730B /* APSwiftHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA17A7551C76E436005D730B /* APSwiftHelpers.framework */; }; 12 | FA17A7651C76E436005D730B /* DebugLoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA17A7641C76E436005D730B /* DebugLoggingTests.swift */; }; 13 | FA17A7701C76E444005D730B /* DebugLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA17A76F1C76E444005D730B /* DebugLogging.swift */; }; 14 | FA17A7711C76E5A6005D730B /* DebugLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA17A76F1C76E444005D730B /* DebugLogging.swift */; }; 15 | FA17A7731C76E705005D730B /* Printable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA17A7721C76E705005D730B /* Printable.swift */; }; 16 | FA46828D1C81A9A8005DD9D5 /* CATransaction+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA46828C1C81A9A8005DD9D5 /* CATransaction+Helpers.swift */; }; 17 | FA46828E1C81AA3F005DD9D5 /* CATransaction+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA46828C1C81A9A8005DD9D5 /* CATransaction+Helpers.swift */; }; 18 | FA4682901C81AA53005DD9D5 /* CATransaction+HelpersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA46828F1C81AA53005DD9D5 /* CATransaction+HelpersTests.swift */; }; 19 | FAA5A9D71C7EE9A900D2F6BE /* NSCoding+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA5A9D61C7EE9A900D2F6BE /* NSCoding+Helpers.swift */; }; 20 | FAA5A9D81C7EEA9D00D2F6BE /* NSCoding+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA5A9D61C7EE9A900D2F6BE /* NSCoding+Helpers.swift */; }; 21 | FAA5A9DA1C7EEAAD00D2F6BE /* NSCoding+HelpersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA5A9D91C7EEAAD00D2F6BE /* NSCoding+HelpersTests.swift */; }; 22 | FAA5A9DC1C7EECF300D2F6BE /* Note.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA5A9DB1C7EECF300D2F6BE /* Note.swift */; }; 23 | FAB0E7601C82D3E600775CF8 /* PlistStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB0E75F1C82D3E600775CF8 /* PlistStub.swift */; }; 24 | FAC6482D1C785FDE009DC380 /* Dispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC6482C1C785FDE009DC380 /* Dispatch.swift */; }; 25 | FAC6482F1C786365009DC380 /* DispatchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC6482E1C786365009DC380 /* DispatchTests.swift */; }; 26 | FAC648301C786375009DC380 /* Dispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC6482C1C785FDE009DC380 /* Dispatch.swift */; }; 27 | FAC648321C7A72A0009DC380 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC648311C7A72A0009DC380 /* App.swift */; }; 28 | FAC648341C7A72E1009DC380 /* AppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC648331C7A72E1009DC380 /* AppTests.swift */; }; 29 | FAC648351C7A72E4009DC380 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC648311C7A72A0009DC380 /* App.swift */; }; 30 | FAC681991C842C6500230945 /* NSLocale+HelpersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC681981C842C6500230945 /* NSLocale+HelpersTests.swift */; }; 31 | FAC6819B1C842CE000230945 /* NSLocale+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC6819A1C842CE000230945 /* NSLocale+Helpers.swift */; }; 32 | FAC6819C1C842CEE00230945 /* NSLocale+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC6819A1C842CE000230945 /* NSLocale+Helpers.swift */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXContainerItemProxy section */ 36 | FA17A7611C76E436005D730B /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = FA17A74C1C76E436005D730B /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = FA17A7541C76E436005D730B; 41 | remoteInfo = APSwiftHelpers; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | FA17A7551C76E436005D730B /* APSwiftHelpers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = APSwiftHelpers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | FA17A7581C76E436005D730B /* APSwiftHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APSwiftHelpers.h; sourceTree = ""; }; 48 | FA17A75A1C76E436005D730B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | FA17A75F1C76E436005D730B /* APSwiftHelpersTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = APSwiftHelpersTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | FA17A7641C76E436005D730B /* DebugLoggingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugLoggingTests.swift; sourceTree = ""; }; 51 | FA17A7661C76E436005D730B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | FA17A76F1C76E444005D730B /* DebugLogging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugLogging.swift; sourceTree = ""; }; 53 | FA17A7721C76E705005D730B /* Printable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Printable.swift; sourceTree = ""; }; 54 | FA46828C1C81A9A8005DD9D5 /* CATransaction+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CATransaction+Helpers.swift"; sourceTree = ""; }; 55 | FA46828F1C81AA53005DD9D5 /* CATransaction+HelpersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CATransaction+HelpersTests.swift"; sourceTree = ""; }; 56 | FAA5A9D61C7EE9A900D2F6BE /* NSCoding+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSCoding+Helpers.swift"; sourceTree = ""; }; 57 | FAA5A9D91C7EEAAD00D2F6BE /* NSCoding+HelpersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSCoding+HelpersTests.swift"; sourceTree = ""; }; 58 | FAA5A9DB1C7EECF300D2F6BE /* Note.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Note.swift; sourceTree = ""; }; 59 | FAB0E75F1C82D3E600775CF8 /* PlistStub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlistStub.swift; sourceTree = ""; }; 60 | FAC6482C1C785FDE009DC380 /* Dispatch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dispatch.swift; sourceTree = ""; }; 61 | FAC6482E1C786365009DC380 /* DispatchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchTests.swift; sourceTree = ""; }; 62 | FAC648311C7A72A0009DC380 /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = ""; }; 63 | FAC648331C7A72E1009DC380 /* AppTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppTests.swift; sourceTree = ""; }; 64 | FAC681981C842C6500230945 /* NSLocale+HelpersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLocale+HelpersTests.swift"; sourceTree = ""; }; 65 | FAC6819A1C842CE000230945 /* NSLocale+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLocale+Helpers.swift"; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | FA17A7511C76E436005D730B /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | FA17A75C1C76E436005D730B /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | FA17A7601C76E436005D730B /* APSwiftHelpers.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | FA17A74B1C76E436005D730B = { 88 | isa = PBXGroup; 89 | children = ( 90 | FA17A7571C76E436005D730B /* APSwiftHelpers */, 91 | FA17A7631C76E436005D730B /* APSwiftHelpersTests */, 92 | FA17A7561C76E436005D730B /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | FA17A7561C76E436005D730B /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | FA17A7551C76E436005D730B /* APSwiftHelpers.framework */, 100 | FA17A75F1C76E436005D730B /* APSwiftHelpersTests.xctest */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | FA17A7571C76E436005D730B /* APSwiftHelpers */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | FA17A7581C76E436005D730B /* APSwiftHelpers.h */, 109 | FA17A75A1C76E436005D730B /* Info.plist */, 110 | FA17A76F1C76E444005D730B /* DebugLogging.swift */, 111 | FAC6482C1C785FDE009DC380 /* Dispatch.swift */, 112 | FAC648311C7A72A0009DC380 /* App.swift */, 113 | FAA5A9D61C7EE9A900D2F6BE /* NSCoding+Helpers.swift */, 114 | FA46828C1C81A9A8005DD9D5 /* CATransaction+Helpers.swift */, 115 | FAC6819A1C842CE000230945 /* NSLocale+Helpers.swift */, 116 | ); 117 | path = APSwiftHelpers; 118 | sourceTree = ""; 119 | }; 120 | FA17A7631C76E436005D730B /* APSwiftHelpersTests */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | FAA5A9DD1C7EECFC00D2F6BE /* Test support */, 124 | FA17A7641C76E436005D730B /* DebugLoggingTests.swift */, 125 | FAC6482E1C786365009DC380 /* DispatchTests.swift */, 126 | FAC648331C7A72E1009DC380 /* AppTests.swift */, 127 | FA17A7661C76E436005D730B /* Info.plist */, 128 | FAA5A9D91C7EEAAD00D2F6BE /* NSCoding+HelpersTests.swift */, 129 | FA46828F1C81AA53005DD9D5 /* CATransaction+HelpersTests.swift */, 130 | FAC681981C842C6500230945 /* NSLocale+HelpersTests.swift */, 131 | ); 132 | path = APSwiftHelpersTests; 133 | sourceTree = ""; 134 | }; 135 | FAA5A9DD1C7EECFC00D2F6BE /* Test support */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | FA17A7721C76E705005D730B /* Printable.swift */, 139 | FAA5A9DB1C7EECF300D2F6BE /* Note.swift */, 140 | FAB0E75F1C82D3E600775CF8 /* PlistStub.swift */, 141 | ); 142 | name = "Test support"; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXHeadersBuildPhase section */ 148 | FA17A7521C76E436005D730B /* Headers */ = { 149 | isa = PBXHeadersBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | FA17A7591C76E436005D730B /* APSwiftHelpers.h in Headers */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXHeadersBuildPhase section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | FA17A7541C76E436005D730B /* APSwiftHelpers */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = FA17A7691C76E436005D730B /* Build configuration list for PBXNativeTarget "APSwiftHelpers" */; 162 | buildPhases = ( 163 | FA17A7501C76E436005D730B /* Sources */, 164 | FA17A7511C76E436005D730B /* Frameworks */, 165 | FA17A7521C76E436005D730B /* Headers */, 166 | FA17A7531C76E436005D730B /* Resources */, 167 | FAC6819D1C843AB300230945 /* ShellScript */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | ); 173 | name = APSwiftHelpers; 174 | productName = APSwiftHelpers; 175 | productReference = FA17A7551C76E436005D730B /* APSwiftHelpers.framework */; 176 | productType = "com.apple.product-type.framework"; 177 | }; 178 | FA17A75E1C76E436005D730B /* APSwiftHelpersTests */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = FA17A76C1C76E436005D730B /* Build configuration list for PBXNativeTarget "APSwiftHelpersTests" */; 181 | buildPhases = ( 182 | FA17A75B1C76E436005D730B /* Sources */, 183 | FA17A75C1C76E436005D730B /* Frameworks */, 184 | FA17A75D1C76E436005D730B /* Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | FA17A7621C76E436005D730B /* PBXTargetDependency */, 190 | ); 191 | name = APSwiftHelpersTests; 192 | productName = APSwiftHelpersTests; 193 | productReference = FA17A75F1C76E436005D730B /* APSwiftHelpersTests.xctest */; 194 | productType = "com.apple.product-type.bundle.unit-test"; 195 | }; 196 | /* End PBXNativeTarget section */ 197 | 198 | /* Begin PBXProject section */ 199 | FA17A74C1C76E436005D730B /* Project object */ = { 200 | isa = PBXProject; 201 | attributes = { 202 | LastSwiftUpdateCheck = 0720; 203 | LastUpgradeCheck = 0720; 204 | ORGANIZATIONNAME = "Alex Plescan"; 205 | TargetAttributes = { 206 | FA17A7541C76E436005D730B = { 207 | CreatedOnToolsVersion = 7.2.1; 208 | }; 209 | FA17A75E1C76E436005D730B = { 210 | CreatedOnToolsVersion = 7.2.1; 211 | }; 212 | }; 213 | }; 214 | buildConfigurationList = FA17A74F1C76E436005D730B /* Build configuration list for PBXProject "APSwiftHelpers" */; 215 | compatibilityVersion = "Xcode 3.2"; 216 | developmentRegion = English; 217 | hasScannedForEncodings = 0; 218 | knownRegions = ( 219 | en, 220 | ); 221 | mainGroup = FA17A74B1C76E436005D730B; 222 | productRefGroup = FA17A7561C76E436005D730B /* Products */; 223 | projectDirPath = ""; 224 | projectRoot = ""; 225 | targets = ( 226 | FA17A7541C76E436005D730B /* APSwiftHelpers */, 227 | FA17A75E1C76E436005D730B /* APSwiftHelpersTests */, 228 | ); 229 | }; 230 | /* End PBXProject section */ 231 | 232 | /* Begin PBXResourcesBuildPhase section */ 233 | FA17A7531C76E436005D730B /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | FA17A75D1C76E436005D730B /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | /* End PBXResourcesBuildPhase section */ 248 | 249 | /* Begin PBXShellScriptBuildPhase section */ 250 | FAC6819D1C843AB300230945 /* ShellScript */ = { 251 | isa = PBXShellScriptBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | ); 255 | inputPaths = ( 256 | ); 257 | outputPaths = ( 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | shellPath = /bin/sh; 261 | shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; 262 | }; 263 | /* End PBXShellScriptBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | FA17A7501C76E436005D730B /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | FAA5A9D71C7EE9A900D2F6BE /* NSCoding+Helpers.swift in Sources */, 271 | FAC648321C7A72A0009DC380 /* App.swift in Sources */, 272 | FAC6819B1C842CE000230945 /* NSLocale+Helpers.swift in Sources */, 273 | FA17A7701C76E444005D730B /* DebugLogging.swift in Sources */, 274 | FA46828D1C81A9A8005DD9D5 /* CATransaction+Helpers.swift in Sources */, 275 | FAC6482D1C785FDE009DC380 /* Dispatch.swift in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | FA17A75B1C76E436005D730B /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | FA46828E1C81AA3F005DD9D5 /* CATransaction+Helpers.swift in Sources */, 284 | FA17A7651C76E436005D730B /* DebugLoggingTests.swift in Sources */, 285 | FAC681991C842C6500230945 /* NSLocale+HelpersTests.swift in Sources */, 286 | FAC6482F1C786365009DC380 /* DispatchTests.swift in Sources */, 287 | FAC648301C786375009DC380 /* Dispatch.swift in Sources */, 288 | FA4682901C81AA53005DD9D5 /* CATransaction+HelpersTests.swift in Sources */, 289 | FA17A7711C76E5A6005D730B /* DebugLogging.swift in Sources */, 290 | FAA5A9D81C7EEA9D00D2F6BE /* NSCoding+Helpers.swift in Sources */, 291 | FAC6819C1C842CEE00230945 /* NSLocale+Helpers.swift in Sources */, 292 | FAA5A9DC1C7EECF300D2F6BE /* Note.swift in Sources */, 293 | FA17A7731C76E705005D730B /* Printable.swift in Sources */, 294 | FAC648351C7A72E4009DC380 /* App.swift in Sources */, 295 | FAA5A9DA1C7EEAAD00D2F6BE /* NSCoding+HelpersTests.swift in Sources */, 296 | FAB0E7601C82D3E600775CF8 /* PlistStub.swift in Sources */, 297 | FAC648341C7A72E1009DC380 /* AppTests.swift in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXTargetDependency section */ 304 | FA17A7621C76E436005D730B /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = FA17A7541C76E436005D730B /* APSwiftHelpers */; 307 | targetProxy = FA17A7611C76E436005D730B /* PBXContainerItemProxy */; 308 | }; 309 | /* End PBXTargetDependency section */ 310 | 311 | /* Begin XCBuildConfiguration section */ 312 | FA17A7671C76E436005D730B /* Debug */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_CONSTANT_CONVERSION = YES; 322 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 323 | CLANG_WARN_EMPTY_BODY = YES; 324 | CLANG_WARN_ENUM_CONVERSION = YES; 325 | CLANG_WARN_INT_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_UNREACHABLE_CODE = YES; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 330 | COPY_PHASE_STRIP = NO; 331 | CURRENT_PROJECT_VERSION = 1; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 354 | TARGETED_DEVICE_FAMILY = "1,2"; 355 | VERSIONING_SYSTEM = "apple-generic"; 356 | VERSION_INFO_PREFIX = ""; 357 | }; 358 | name = Debug; 359 | }; 360 | FA17A7681C76E436005D730B /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 365 | CLANG_CXX_LIBRARY = "libc++"; 366 | CLANG_ENABLE_MODULES = YES; 367 | CLANG_ENABLE_OBJC_ARC = YES; 368 | CLANG_WARN_BOOL_CONVERSION = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 375 | CLANG_WARN_UNREACHABLE_CODE = YES; 376 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 377 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 378 | COPY_PHASE_STRIP = NO; 379 | CURRENT_PROJECT_VERSION = 1; 380 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 381 | ENABLE_NS_ASSERTIONS = NO; 382 | ENABLE_STRICT_OBJC_MSGSEND = YES; 383 | GCC_C_LANGUAGE_STANDARD = gnu99; 384 | GCC_NO_COMMON_BLOCKS = YES; 385 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 386 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 387 | GCC_WARN_UNDECLARED_SELECTOR = YES; 388 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 389 | GCC_WARN_UNUSED_FUNCTION = YES; 390 | GCC_WARN_UNUSED_VARIABLE = YES; 391 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 392 | MTL_ENABLE_DEBUG_INFO = NO; 393 | SDKROOT = iphoneos; 394 | TARGETED_DEVICE_FAMILY = "1,2"; 395 | VALIDATE_PRODUCT = YES; 396 | VERSIONING_SYSTEM = "apple-generic"; 397 | VERSION_INFO_PREFIX = ""; 398 | }; 399 | name = Release; 400 | }; 401 | FA17A76A1C76E436005D730B /* Debug */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | CLANG_ENABLE_MODULES = YES; 405 | DEFINES_MODULE = YES; 406 | DYLIB_COMPATIBILITY_VERSION = 1; 407 | DYLIB_CURRENT_VERSION = 1; 408 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 409 | INFOPLIST_FILE = APSwiftHelpers/Info.plist; 410 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 411 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_BUNDLE_IDENTIFIER = "Alex-Plescan.APSwiftHelpers"; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | SKIP_INSTALL = YES; 416 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 417 | }; 418 | name = Debug; 419 | }; 420 | FA17A76B1C76E436005D730B /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | CLANG_ENABLE_MODULES = YES; 424 | DEFINES_MODULE = YES; 425 | DYLIB_COMPATIBILITY_VERSION = 1; 426 | DYLIB_CURRENT_VERSION = 1; 427 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 428 | INFOPLIST_FILE = APSwiftHelpers/Info.plist; 429 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 430 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 431 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 432 | PRODUCT_BUNDLE_IDENTIFIER = "Alex-Plescan.APSwiftHelpers"; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | SKIP_INSTALL = YES; 435 | }; 436 | name = Release; 437 | }; 438 | FA17A76D1C76E436005D730B /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | buildSettings = { 441 | INFOPLIST_FILE = APSwiftHelpersTests/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = "Alex-Plescan.APSwiftHelpersTests"; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | }; 446 | name = Debug; 447 | }; 448 | FA17A76E1C76E436005D730B /* Release */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | INFOPLIST_FILE = APSwiftHelpersTests/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 453 | PRODUCT_BUNDLE_IDENTIFIER = "Alex-Plescan.APSwiftHelpersTests"; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | }; 456 | name = Release; 457 | }; 458 | /* End XCBuildConfiguration section */ 459 | 460 | /* Begin XCConfigurationList section */ 461 | FA17A74F1C76E436005D730B /* Build configuration list for PBXProject "APSwiftHelpers" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | FA17A7671C76E436005D730B /* Debug */, 465 | FA17A7681C76E436005D730B /* Release */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | FA17A7691C76E436005D730B /* Build configuration list for PBXNativeTarget "APSwiftHelpers" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | FA17A76A1C76E436005D730B /* Debug */, 474 | FA17A76B1C76E436005D730B /* Release */, 475 | ); 476 | defaultConfigurationIsVisible = 0; 477 | defaultConfigurationName = Release; 478 | }; 479 | FA17A76C1C76E436005D730B /* Build configuration list for PBXNativeTarget "APSwiftHelpersTests" */ = { 480 | isa = XCConfigurationList; 481 | buildConfigurations = ( 482 | FA17A76D1C76E436005D730B /* Debug */, 483 | FA17A76E1C76E436005D730B /* Release */, 484 | ); 485 | defaultConfigurationIsVisible = 0; 486 | defaultConfigurationName = Release; 487 | }; 488 | /* End XCConfigurationList section */ 489 | }; 490 | rootObject = FA17A74C1C76E436005D730B /* Project object */; 491 | } 492 | --------------------------------------------------------------------------------