Skip to content

Commit 213e057

Browse files
committed
🗑️ Remove AnyInteger
Replaced by NSNumber.
1 parent 0f12b08 commit 213e057

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

Sources/Codable/CodableSupport.swift

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -211,60 +211,6 @@ class DictionaryStorage {
211211

212212
}
213213

214-
// MARK: - AnyInteger
215-
216-
///
217-
/// An object that wraps a generic integer value.
218-
///
219-
220-
class AnyInteger {
221-
222-
private let stringGenerator: () -> String
223-
private let intGenerator: () -> Int
224-
225-
/// Creates a wrapper from a base integer.
226-
init<T: FixedWidthInteger>(_ base: T) {
227-
228-
stringGenerator = {
229-
return String(base, radix: 10, uppercase: false)
230-
}
231-
232-
intGenerator = {
233-
return Int(base)
234-
}
235-
236-
}
237-
238-
/// The `String` representation of the integer.
239-
var stringValue: String {
240-
return stringGenerator()
241-
}
242-
243-
/// The `Int` representation of the integer.
244-
var rawValue: Int {
245-
return intGenerator()
246-
}
247-
248-
/// Converts the integer to another integer type or returns `nil` if the target type is too
249-
/// small to contain the `intValue`.
250-
func makeSpecializedInteger<T: BinaryInteger & FixedWidthInteger>() -> T? {
251-
252-
let intValue = self.rawValue
253-
254-
guard T.bitWidth <= Int.bitWidth else {
255-
return nil
256-
}
257-
258-
guard intValue >= T.min && intValue <= T.max else {
259-
return nil
260-
}
261-
262-
return T(intValue)
263-
264-
}
265-
266-
}
267-
268214
// MARK: - Escaping
269215

270216
extension String {

0 commit comments

Comments
 (0)