-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compilation errors on earlier versions of swift
- Loading branch information
Showing
9 changed files
with
205 additions
and
78 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
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,150 @@ | ||
import Foundation | ||
|
||
#if swift(>=6) | ||
extension Int8: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int8Value | ||
} | ||
} | ||
|
||
extension UInt8: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint8Value | ||
} | ||
} | ||
|
||
extension Int16: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int16Value | ||
} | ||
} | ||
|
||
extension UInt16: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint16Value | ||
} | ||
} | ||
|
||
extension Int32: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int32Value | ||
} | ||
} | ||
|
||
extension UInt32: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint32Value | ||
} | ||
} | ||
|
||
extension Int64: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int64Value | ||
} | ||
} | ||
|
||
extension UInt64: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint64Value | ||
} | ||
} | ||
|
||
extension Float: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).floatValue | ||
} | ||
} | ||
|
||
extension Double: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).doubleValue | ||
} | ||
} | ||
|
||
extension Int: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).intValue | ||
} | ||
} | ||
|
||
extension UInt: @retroactive ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uintValue | ||
} | ||
} | ||
|
||
#else | ||
|
||
extension Int8: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int8Value | ||
} | ||
} | ||
|
||
extension UInt8: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint8Value | ||
} | ||
} | ||
|
||
extension Int16: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int16Value | ||
} | ||
} | ||
|
||
extension UInt16: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint16Value | ||
} | ||
} | ||
|
||
extension Int32: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int32Value | ||
} | ||
} | ||
|
||
extension UInt32: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint32Value | ||
} | ||
} | ||
|
||
extension Int64: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).int64Value | ||
} | ||
} | ||
|
||
extension UInt64: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uint64Value | ||
} | ||
} | ||
|
||
extension Float: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).floatValue | ||
} | ||
} | ||
|
||
extension Double: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).doubleValue | ||
} | ||
} | ||
|
||
extension Int: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).intValue | ||
} | ||
} | ||
|
||
extension UInt: ExpressibleByBooleanLiteral { | ||
public init(booleanLiteral value: Bool) { | ||
self = NSNumber(value: value).uintValue | ||
} | ||
} | ||
|
||
#endif |
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
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
Oops, something went wrong.