This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some things into a deprecated file. #8
- Loading branch information
Showing
4 changed files
with
68 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Deprecated.swift | ||
// Alexander | ||
// | ||
// Created by Caleb Davenport on 11/19/15. | ||
// Copyright © 2015 Hodinkee. All rights reserved. | ||
// | ||
|
||
extension JSON { | ||
@available(*, deprecated, message = "Use stringValue instead.") | ||
public var string: String? { | ||
return stringValue | ||
} | ||
|
||
@available(*, deprecated, message = "Use intValue instead.") | ||
public var int: Int? { | ||
return intValue | ||
} | ||
|
||
public var double: Double? { | ||
return object as? Double | ||
} | ||
|
||
@available(*, deprecated, message = "Use boolValue instead.") | ||
public var bool: Bool? { | ||
return boolValue | ||
} | ||
|
||
@available(*, deprecated, message = "Use decode(NSURLDecoder) instead.") | ||
public var url: NSURL? { | ||
return decode(NSURLDecoder) | ||
} | ||
|
||
@available(*, deprecated, message = "Use decode(NSTimeIntervalDecoder) instead.") | ||
public var timeInterval: NSTimeInterval? { | ||
return decode(NSTimeIntervalDecoder) | ||
} | ||
|
||
@available(*, deprecated, message = "Use decode(NSDateTimeIntervalSince1970Decoder) instead.") | ||
public var date: NSDate? { | ||
return decode(NSDateTimeIntervalSince1970Decoder) | ||
} | ||
} | ||
|
||
@available(*, deprecated, message = "Use DecoderType instead.") | ||
public protocol JSONDecodable { | ||
static func decode(JSON: Alexander.JSON) -> Self? | ||
} | ||
|
||
public extension Alexander.JSON { | ||
public func decode<T: JSONDecodable>(type: T.Type) -> T? { | ||
return decode(T.decode) | ||
} | ||
|
||
public func decodeArray<T: JSONDecodable>(type: T.Type) -> [T]? { | ||
return decodeArray(T.decode) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters