Skip to content

Commit 7da54bd

Browse files
committed
[master] - Release v1.3.0
1 parent 8107c10 commit 7da54bd

File tree

16 files changed

+89
-69
lines changed

16 files changed

+89
-69
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

AlamoRecord.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Pod::Spec.new do |s|
33
s.name = 'AlamoRecord'
4-
s.version = '1.2.2'
4+
s.version = '1.3.0'
55
s.summary = 'An elegant Alamofire wrapper inspired by ActiveRecord.'
66
s.description = <<-DESC
77
AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networking framework and your application. AlamoRecord uses the power of AlamoFire, AlamofireObjectMapper and the concepts behind the ActiveRecord pattern to create a networking layer that makes interacting with your API easier than ever.
@@ -11,6 +11,7 @@ AlamoRecord is a powerful yet simple framework that eliminates the often complex
1111
s.license = { :type => 'MIT', :file => 'LICENSE' }
1212
s.author = { 'Tunespeak' => 'daltonhint4@gmail.com' }
1313
s.source = { :git => 'https://github.com/tunespeak/AlamoRecord.git', :tag => s.version.to_s }
14+
s.swift_version = '4.2'
1415

1516
s.ios.deployment_target = '9.0'
1617
s.osx.deployment_target = '10.11'

AlamoRecord/Classes/AlamoRecordObject.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ import Alamofire
2020
import AlamofireObjectMapper
2121
import ObjectMapper
2222

23-
open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Mappable {
23+
open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError, IDType>: NSObject, Mappable {
2424

2525
/// Key to encode/decode the id variable
2626
private let idKey: String = "id"
2727

2828
/// The RequestManager that is tied to all instances of this class
29-
open class var requestManager: RequestManager<U, E> {
29+
open class var requestManager: RequestManager<U, E, IDType> {
3030
fatalError("requestManager must be overriden in your AlamoRecordObject subclass")
3131
}
3232

3333
/// The RequestManager that is tied to this instance
34-
open var requestManager: RequestManager<U, E> {
34+
open var requestManager: RequestManager<U, E, IDType> {
3535
return type(of: self).requestManager
3636
}
3737

38-
/// The id of this instance. This can be a String or an Int.
39-
open var id: Any!
38+
/// The id of this instance. This should be a String or an Int.
39+
open var id: IDType!
4040

4141
/// The root of all instances of this class. This is used when making URL's that relate to a component of this class.
4242
// Example: '/comment/id' --> '/\(Comment.root)/id'
@@ -188,7 +188,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
188188
- parameter failure: The block to execute if the request fails
189189
*/
190190
@discardableResult
191-
open class func find<T: AlamoRecordObject>(id: Any,
191+
open class func find<T: AlamoRecordObject>(id: IDType,
192192
parameters: Parameters? = nil,
193193
encoding: ParameterEncoding = URLEncoding.default,
194194
headers: HTTPHeaders? = nil,
@@ -237,7 +237,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
237237
- parameter failure: The block to execute if the request fails
238238
*/
239239
@discardableResult
240-
open class func update<T: AlamoRecordObject>(id: Any,
240+
open class func update<T: AlamoRecordObject>(id: IDType,
241241
parameters: Parameters? = nil,
242242
encoding: ParameterEncoding = URLEncoding.default,
243243
headers: HTTPHeaders? = nil,
@@ -263,7 +263,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
263263
- parameter failure: The block to execute if the request fails
264264
*/
265265
@discardableResult
266-
open class func update(id: Any,
266+
open class func update(id: IDType,
267267
parameters: Parameters? = nil,
268268
encoding: ParameterEncoding = URLEncoding.default,
269269
headers: HTTPHeaders? = nil,
@@ -335,7 +335,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
335335
- parameter failure: The block to execute if the request fails
336336
*/
337337
@discardableResult
338-
open class func destroy(id: Any,
338+
open class func destroy(id: IDType,
339339
parameters: Parameters? = nil,
340340
encoding: ParameterEncoding = URLEncoding.default,
341341
headers: HTTPHeaders? = nil,
@@ -365,7 +365,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
365365
The URL to use when making a find request for all objects of this instance
366366
- parameter id: The id of the object to find
367367
*/
368-
open class func urlForFind(_ id: Any) -> U {
368+
open class func urlForFind(_ id: IDType) -> U {
369369
return U(url: "\(pluralRoot)/\(id)")
370370
}
371371

@@ -377,7 +377,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
377377
The URL to use when making an update request for all objects of this instance
378378
- parameter id: The id of the object to update
379379
*/
380-
open class func urlForUpdate(_ id: Any) -> U {
380+
open class func urlForUpdate(_ id: IDType) -> U {
381381
return U(url: "\(pluralRoot)/\(id)")
382382
}
383383

@@ -389,7 +389,7 @@ open class AlamoRecordObject<U: URLProtocol, E: AlamoRecordError>: NSObject, Map
389389
The URL to use when making a destroy request for all objects this instance
390390
- parameter id: The id of the object to destroy
391391
*/
392-
open class func urlForDestroy(_ id: Any) -> U {
392+
open class func urlForDestroy(_ id: IDType) -> U {
393393
return U(url: "\(pluralRoot)/\(id)")
394394
}
395395

AlamoRecord/Classes/Logger.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Logger: NSObject {
5555
let statusCode = responseObject.statusCode
5656
let statusCodeString = statusCodeStrings[statusCode]
5757
let duration = String(response.timeline.totalDuration)
58-
let trimmedDuration = duration.substring(to: duration.index(duration.startIndex, offsetBy: 4))
58+
let trimmedDuration = String(duration[duration.startIndex..<duration.index(duration.startIndex, offsetBy: 4)])
5959
print("\(emoji(for: statusCode)) \(loggerPrefix) \(method) \(urlString) (\(statusCode) \(statusCodeString!)) \(trimmedDuration) seconds")
6060
}
6161
}

AlamoRecord/Classes/RequestManager.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Alamofire
2020
import AlamofireObjectMapper
2121
import ObjectMapper
2222

23-
open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
23+
open class RequestManager<U: URLProtocol, E: AlamoRecordError, IDType>: NSObject {
2424

2525
public typealias Parameters = [String: Any]
2626

@@ -205,7 +205,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
205205
- parameter failure: The block to execute if the request fails
206206
*/
207207
@discardableResult
208-
public func findObject<T: AlamoRecordObject<U, E>>(id: Any,
208+
public func findObject<T: AlamoRecordObject<U, E, IDType>>(id: IDType,
209209
parameters: Parameters? = nil,
210210
keyPath: String? = nil,
211211
encoding: ParameterEncoding = URLEncoding.default,
@@ -233,7 +233,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
233233
- parameter failure: The block to execute if the request fails
234234
*/
235235
@discardableResult
236-
public func findObject<T: AlamoRecordObject<U, E>>(url: U,
236+
public func findObject<T: AlamoRecordObject<U, E, IDType>>(url: U,
237237
parameters: Parameters? = nil,
238238
keyPath: String? = nil,
239239
encoding: ParameterEncoding = URLEncoding.default,
@@ -290,7 +290,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
290290
- parameter failure: The block to execute if the request fails
291291
*/
292292
@discardableResult
293-
public func createObject<T: AlamoRecordObject<U, E>>(parameters: Parameters? = nil,
293+
public func createObject<T: AlamoRecordObject<U, E, IDType>>(parameters: Parameters? = nil,
294294
keyPath: String? = nil,
295295
encoding: ParameterEncoding = URLEncoding.default,
296296
headers: HTTPHeaders? = nil,
@@ -317,7 +317,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
317317
- parameter failure: The block to execute if the request fails
318318
*/
319319
@discardableResult
320-
public func createObject<T: AlamoRecordObject<U, E>>(url: U,
320+
public func createObject<T: AlamoRecordObject<U, E, IDType>>(url: U,
321321
parameters: Parameters? = nil,
322322
keyPath: String? = nil,
323323
encoding: ParameterEncoding = URLEncoding.default,
@@ -371,7 +371,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
371371
- parameter failure: The block to execute if the request fails
372372
*/
373373
@discardableResult
374-
public func updateObject<T: AlamoRecordObject<U, E>>(id: Any,
374+
public func updateObject<T: AlamoRecordObject<U, E, IDType>>(id: IDType,
375375
parameters: Parameters? = nil,
376376
keyPath: String? = nil,
377377
encoding: ParameterEncoding = URLEncoding.default,
@@ -399,7 +399,7 @@ open class RequestManager<U: URLProtocol, E: AlamoRecordError>: NSObject {
399399
- parameter failure: The block to execute if the request fails
400400
*/
401401
@discardableResult
402-
public func updateObject<T: AlamoRecordObject<U, E>>(url: U,
402+
public func updateObject<T: AlamoRecordObject<U, E, IDType>>(url: U,
403403
parameters: Parameters? = nil,
404404
keyPath: String? = nil,
405405
encoding: ParameterEncoding = URLEncoding.default,

Example/AlamoRecord.xcodeproj/project.pbxproj

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,18 @@
335335
isa = PBXProject;
336336
attributes = {
337337
LastSwiftUpdateCheck = 0830;
338-
LastUpgradeCheck = 0820;
338+
LastUpgradeCheck = 1000;
339339
ORGANIZATIONNAME = CocoaPods;
340340
TargetAttributes = {
341341
5C6346FA1F0B076B00158A80 = {
342342
CreatedOnToolsVersion = 8.3.2;
343-
LastSwiftMigration = 0830;
343+
LastSwiftMigration = 1000;
344344
ProvisioningStyle = Automatic;
345345
TestTargetID = 607FACCF1AFB9204008FA782;
346346
};
347347
607FACCF1AFB9204008FA782 = {
348348
CreatedOnToolsVersion = 6.3.1;
349-
LastSwiftMigration = 0820;
349+
LastSwiftMigration = 1000;
350350
};
351351
};
352352
};
@@ -579,7 +579,7 @@
579579
PRODUCT_NAME = "$(TARGET_NAME)";
580580
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
581581
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
582-
SWIFT_VERSION = 4.0;
582+
SWIFT_VERSION = 4.2;
583583
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AlamoRecord_Example.app/AlamoRecord_Example";
584584
};
585585
name = Debug;
@@ -597,7 +597,7 @@
597597
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
598598
PRODUCT_BUNDLE_IDENTIFIER = com.daltron.Tests;
599599
PRODUCT_NAME = "$(TARGET_NAME)";
600-
SWIFT_VERSION = 4.0;
600+
SWIFT_VERSION = 4.2;
601601
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AlamoRecord_Example.app/AlamoRecord_Example";
602602
};
603603
name = Release;
@@ -610,14 +610,22 @@
610610
CLANG_CXX_LIBRARY = "libc++";
611611
CLANG_ENABLE_MODULES = YES;
612612
CLANG_ENABLE_OBJC_ARC = YES;
613+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
613614
CLANG_WARN_BOOL_CONVERSION = YES;
615+
CLANG_WARN_COMMA = YES;
614616
CLANG_WARN_CONSTANT_CONVERSION = YES;
617+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
615618
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
616619
CLANG_WARN_EMPTY_BODY = YES;
617620
CLANG_WARN_ENUM_CONVERSION = YES;
618621
CLANG_WARN_INFINITE_RECURSION = YES;
619622
CLANG_WARN_INT_CONVERSION = YES;
623+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
624+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
625+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
620626
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
627+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
628+
CLANG_WARN_STRICT_PROTOTYPES = YES;
621629
CLANG_WARN_SUSPICIOUS_MOVE = YES;
622630
CLANG_WARN_UNREACHABLE_CODE = YES;
623631
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -657,14 +665,22 @@
657665
CLANG_CXX_LIBRARY = "libc++";
658666
CLANG_ENABLE_MODULES = YES;
659667
CLANG_ENABLE_OBJC_ARC = YES;
668+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
660669
CLANG_WARN_BOOL_CONVERSION = YES;
670+
CLANG_WARN_COMMA = YES;
661671
CLANG_WARN_CONSTANT_CONVERSION = YES;
672+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
662673
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
663674
CLANG_WARN_EMPTY_BODY = YES;
664675
CLANG_WARN_ENUM_CONVERSION = YES;
665676
CLANG_WARN_INFINITE_RECURSION = YES;
666677
CLANG_WARN_INT_CONVERSION = YES;
678+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
679+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
680+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
667681
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
682+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
683+
CLANG_WARN_STRICT_PROTOTYPES = YES;
668684
CLANG_WARN_SUSPICIOUS_MOVE = YES;
669685
CLANG_WARN_UNREACHABLE_CODE = YES;
670686
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -700,7 +716,7 @@
700716
MODULE_NAME = ExampleApp;
701717
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
702718
PRODUCT_NAME = "$(TARGET_NAME)";
703-
SWIFT_VERSION = 4.0;
719+
SWIFT_VERSION = 4.2;
704720
};
705721
name = Debug;
706722
};
@@ -715,7 +731,7 @@
715731
MODULE_NAME = ExampleApp;
716732
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
717733
PRODUCT_NAME = "$(TARGET_NAME)";
718-
SWIFT_VERSION = 4.0;
734+
SWIFT_VERSION = 4.2;
719735
};
720736
name = Release;
721737
};

Example/AlamoRecord.xcodeproj/xcshareddata/xcschemes/AlamoRecord-Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0820"
3+
LastUpgradeVersion = "1000"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Example/AlamoRecord/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818
// Override point for customization after application launch.
1919

2020
if let _ = NSClassFromString("XCTest") {

Example/AlamoRecord/Comment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import ObjectMapper
1010
import UIKit
1111

12-
class Comment: AlamoRecordObject<ApplicationURL, ApplicationError> {
12+
class Comment: AlamoRecordObject<ApplicationURL, ApplicationError, Int> {
1313

14-
class override var requestManager: RequestManager<ApplicationURL, ApplicationError> {
14+
class override var requestManager: ApplicationRequestManager {
1515
return ApplicationRequestManager.default
1616
}
1717

Example/AlamoRecord/CommentsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class CommentsView: UIView {
2626
tableView = UITableView(frame: .zero, style: .plain)
2727
tableView.backgroundColor = .darkWhite
2828
tableView.separatorStyle = .none
29-
tableView.rowHeight = UITableViewAutomaticDimension
29+
tableView.rowHeight = UITableView.automaticDimension
3030
tableView.estimatedRowHeight = 50.0
3131
tableView.dataSource = self
3232
tableView.delegate = self
33-
tableView.contentInset = UIEdgeInsetsMake(0, 0, 10, 0)
33+
tableView.contentInset = UIEdgeInsets.init(top: 0, left: 0, bottom: 10, right: 0)
3434
addSubview(tableView)
3535

3636
tableView.snp.makeConstraints { (make) in

0 commit comments

Comments
 (0)