Skip to content

Commit 8ea5096

Browse files
committed
Repository source directory changes.
1 parent 64bef9f commit 8ea5096

File tree

12 files changed

+259
-155
lines changed

12 files changed

+259
-155
lines changed

CodeQuickKit.podspec

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,50 @@
88

99
Pod::Spec.new do |s|
1010
s.name = "CodeQuickKit"
11-
s.version = "2.1.0"
11+
s.version = "2.2.0"
1212
s.summary = "An iOS Library simplifying some everyday tasks."
1313
s.description = <<-DESC
1414
CodeQuickKit is a collection of Swift extensions and classes designed to
1515
quicken iOS development. This collection includes (but not limited to): logging,
1616
NSObject/JSON de/serialization, JSON Web APIs, UIStoryboard/UIAlertController shortcuts,
1717
and CoreData wrappers.
1818
DESC
19-
2019
s.homepage = "https://github.com/richardpiazza/CodeQuickKit"
2120
s.license = 'MIT'
2221
s.author = { "Richard Piazza" => "[email protected]" }
2322
s.social_media_url = 'https://twitter.com/richardpiazza'
2423

2524
s.source = { :git => "https://github.com/richardpiazza/CodeQuickKit.git", :tag => s.version.to_s }
26-
s.platform = :ios, '8.0'
27-
s.frameworks = 'CoreData', 'UIKit'
2825
s.requires_arc = true
29-
s.default_subspec = 'Foundation'
26+
s.default_subspec = 'iOS'
3027

3128
s.subspec 'Foundation' do |foundation|
29+
foundation.frameworks = 'Foundation'
3230
foundation.source_files = 'Sources/Foundation/*'
3331
end
3432

33+
s.subspec 'CoreData' do |coredata|
34+
coredata.dependency 'CodeQuickKit/Foundation'
35+
coredata.frameworks = 'CoreData'
36+
coredata.source_files = 'Sources/CoreData/*'
37+
end
38+
39+
s.subspec 'UIKit' do |uikit|
40+
uikit.dependency 'CodeQuickKit/Foundation'
41+
uikit.frameworks = 'UIKit'
42+
uikit.source_files = 'Sources/UIKit/*'
43+
end
44+
3545
s.subspec 'iOS' do |ios|
46+
ios.dependency 'CodeQuickKit/UIKit'
3647
ios.platform = :ios, '8.0'
3748
ios.source_files = 'Sources/iOS/*'
3849
end
3950

4051
s.subspec 'tvOS' do |tvos|
52+
tvos.dependency 'CodeQuickKit/Foundation'
4153
tvos.platform = :tvos, '9.0'
42-
tvos.source_files = 'Sources/tvOS/*'
54+
#tvos.source_files = 'Sources/tvOS/*'
4355
end
4456

4557
end

CodeQuickKit/CodeQuickKit.xcodeproj/project.pbxproj

Lines changed: 136 additions & 88 deletions
Large diffs are not rendered by default.

CodeQuickKit/CodeQuickKit/CodeQuickKit.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,3 @@ FOUNDATION_EXPORT double iOSVersionNumber;
1414
//! Project version string for iOS.
1515
FOUNDATION_EXPORT const unsigned char iOSVersionString[];
1616

17-
// In this header, you should import all the public headers of your framework using statements like #import <iOS/PublicHeader.h>
18-
//#import <CodeQuickKit/CQKCoreDataStack.h>
19-
//#import <CodeQuickKit/CQKLogger.h>
20-
//#import <CodeQuickKit/CQKSerializable.h>
21-
//#import <CodeQuickKit/CQKSerializableConfiguration.h>
22-
//#import <CodeQuickKit/CQKSerializableNSManagedObject.h>
23-
//#import <CodeQuickKit/CQKSerializableNSObject.h>
24-
//#import <CodeQuickKit/CQKUbiquityNSFileManager.h>
25-
//#import <CodeQuickKit/CQKWebAPI.h>
26-
//#import <CodeQuickKit/NSBundle+CQKBundle.h>
27-
//#import <CodeQuickKit/NSFileManager+CQKSandbox.h>
28-
//#import <CodeQuickKit/NSNumberFormatter+CQKNumberFormatters.h>
29-
//#import <CodeQuickKit/NSData+CQKCrypto.h>
30-
//#import <CodeQuickKit/NSDate+CQKDates.h>
31-
//#import <CodeQuickKit/NSDateFormatter+CQKDateFormatter.h>
32-
//#import <CodeQuickKit/NSObject+CQKRuntime.h>
33-
//#import <CodeQuickKit/UIAlertController+CQKAlerts.h>
34-
//#import <CodeQuickKit/UIStoryboard+CQKStoryboards.h>
File renamed without changes.

Sources/Foundation/Downloader.swift

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
//===----------------------------------------------------------------------===//
2727

2828
import Foundation
29-
import UIKit
3029

3130
public typealias DownloaderDataCompletion = (statusCode: Int, responseData: NSData?, error: NSError?) -> Void
32-
public typealias DownloaderImageCompletion = (statusCode: Int, responseImage: UIImage?, error: NSError?) -> Void
3331

3432
/// A wrapper for `NSURLSession` similar to `WebAPI` for general purpose
3533
/// downloading of data and images.
@@ -48,7 +46,7 @@ public class Downloader {
4846
public var baseURL: NSURL?
4947
public var timeout: NSTimeInterval = 20
5048

51-
private lazy var invalidBaseURL: NSError = {
49+
internal lazy var invalidBaseURL: NSError = {
5250
let userInfo: [String : AnyObject] = [NSLocalizedDescriptionKey:"Invalid Base URL", NSLocalizedFailureReasonErrorKey:"You can not use a `path` method without specifiying a baseURL."]
5351
return NSError(domain: "Downloader", code: 0, userInfo: userInfo)
5452
}()
@@ -61,7 +59,7 @@ public class Downloader {
6159
self.baseURL = baseURL
6260
}
6361

64-
private func urlForPath(path: String) -> NSURL? {
62+
internal func urlForPath(path: String) -> NSURL? {
6563
guard let baseURL = self.baseURL else {
6664
return nil
6765
}
@@ -94,24 +92,4 @@ public class Downloader {
9492
})
9593
}.resume()
9694
}
97-
98-
public func getImageAtPath(path: String, cachePolicy: NSURLRequestCachePolicy, completion: DownloaderImageCompletion) {
99-
guard let url = self.urlForPath(path) else {
100-
completion(statusCode: 0, responseImage: nil, error: invalidBaseURL)
101-
return
102-
}
103-
104-
self.getImageAtURL(url, cachePolicy: cachePolicy, completion: completion)
105-
}
106-
107-
public func getImageAtURL(url: NSURL, cachePolicy: NSURLRequestCachePolicy, completion: DownloaderImageCompletion) {
108-
self.getDataAtURL(url, cachePolicy: cachePolicy) { (statusCode, responseData, error) -> Void in
109-
var image: UIImage?
110-
if responseData != nil {
111-
image = UIImage(data: responseData!)
112-
}
113-
114-
completion(statusCode: statusCode, responseImage: image, error: error)
115-
}
116-
}
11795
}

Sources/Foundation/NSBundle.swift

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//
2626
//===----------------------------------------------------------------------===//
2727

28-
import UIKit
28+
import Foundation
2929

3030
public enum BundleConfiguration {
3131
case Debug
@@ -74,24 +74,6 @@ public extension NSBundle {
7474
#endif
7575
}
7676

77-
/// This call potentially throws an execption that cannot be caught.
78-
public var launchScreenStoryboard: UIStoryboard? {
79-
guard let name = launchScreenStoryboardName else {
80-
return nil
81-
}
82-
83-
return UIStoryboard(name: name, bundle: self)
84-
}
85-
86-
/// This call potentially throws an execption that cannot be caught.
87-
public var mainStoryboard: UIStoryboard? {
88-
guard let name = mainStoryboardName else {
89-
return nil
90-
}
91-
92-
return UIStoryboard(name: name, bundle: self)
93-
}
94-
9577
override var description: String {
9678
return "Bundle: \(dictionary)"
9779
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Downloader+UIKit.swift
4+
//
5+
// Copyright (c) 2016 Richard Piazza
6+
// https://github.com/richardpiazza/CodeQuickKit
7+
//
8+
// Permission is hereby granted, free of charge, to any person obtaining a copy
9+
// of this software and associated documentation files (the "Software"), to deal
10+
// in the Software without restriction, including without limitation the rights
11+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
// copies of the Software, and to permit persons to whom the Software is
13+
// furnished to do so, subject to the following conditions:
14+
//
15+
// The above copyright notice and this permission notice shall be included in all
16+
// copies or substantial portions of the Software.
17+
//
18+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
// SOFTWARE.
25+
//
26+
//===----------------------------------------------------------------------===//
27+
28+
import UIKit
29+
30+
public typealias DownloaderImageCompletion = (statusCode: Int, responseImage: UIImage?, error: NSError?) -> Void
31+
32+
/// A wrapper for `NSURLSession` similar to `WebAPI` for general purpose
33+
/// downloading of data and images.
34+
public extension Downloader {
35+
public func getImageAtPath(path: String, cachePolicy: NSURLRequestCachePolicy, completion: DownloaderImageCompletion) {
36+
guard let url = self.urlForPath(path) else {
37+
completion(statusCode: 0, responseImage: nil, error: invalidBaseURL)
38+
return
39+
}
40+
41+
self.getImageAtURL(url, cachePolicy: cachePolicy, completion: completion)
42+
}
43+
44+
public func getImageAtURL(url: NSURL, cachePolicy: NSURLRequestCachePolicy, completion: DownloaderImageCompletion) {
45+
self.getDataAtURL(url, cachePolicy: cachePolicy) { (statusCode, responseData, error) -> Void in
46+
var image: UIImage?
47+
if responseData != nil {
48+
image = UIImage(data: responseData!)
49+
}
50+
51+
completion(statusCode: statusCode, responseImage: image, error: error)
52+
}
53+
}
54+
}

Sources/UIKit/NSBundle+UIKit.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// NSBundle+UIKit.swift
4+
//
5+
// Copyright (c) 2016 Richard Piazza
6+
// https://github.com/richardpiazza/CodeQuickKit
7+
//
8+
// Permission is hereby granted, free of charge, to any person obtaining a copy
9+
// of this software and associated documentation files (the "Software"), to deal
10+
// in the Software without restriction, including without limitation the rights
11+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
// copies of the Software, and to permit persons to whom the Software is
13+
// furnished to do so, subject to the following conditions:
14+
//
15+
// The above copyright notice and this permission notice shall be included in all
16+
// copies or substantial portions of the Software.
17+
//
18+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
// SOFTWARE.
25+
//
26+
//===----------------------------------------------------------------------===//
27+
28+
import UIKit
29+
30+
public extension NSBundle {
31+
/// This call potentially throws an execption that cannot be caught.
32+
public var launchScreenStoryboard: UIStoryboard? {
33+
guard let name = launchScreenStoryboardName else {
34+
return nil
35+
}
36+
37+
return UIStoryboard(name: name, bundle: self)
38+
}
39+
40+
/// This call potentially throws an execption that cannot be caught.
41+
public var mainStoryboard: UIStoryboard? {
42+
guard let name = mainStoryboardName else {
43+
return nil
44+
}
45+
46+
return UIStoryboard(name: name, bundle: self)
47+
}
48+
}
File renamed without changes.

0 commit comments

Comments
 (0)