1- import Foundation
2-
31extension IG . API {
42 /// A user within the platform.
53 public struct User : ExpressibleByArrayLiteral {
@@ -11,7 +9,7 @@ extension IG.API {
119 /// Initializer providing already with fully formed sub-instances.
1210 /// - parameter name: The user's platform name.
1311 /// - parameter password: The user's password.
14- @inlinable public init ( _ name: Self . Name , _ password: Self . Password ) {
12+ @_transparent public init ( _ name: Self . Name , _ password: Self . Password ) {
1513 self . name = name
1614 self . password = password
1715 }
@@ -20,14 +18,14 @@ extension IG.API {
2018 /// - parameter name: The user's platform name.
2119 /// - parameter password: The user's password.
2220 /// - returns: `nil` if the objects were malformed.
23- @inlinable public init ? ( name: String , passsword: String ) {
21+ @_transparent public init ? ( name: String , passsword: String ) {
2422 guard let username = Self . Name ( rawValue: name) ,
2523 let password = Self . Password ( rawValue: passsword) else { return nil }
2624 self . init ( username, password)
2725 }
2826
29- @inlinable public init ( arrayLiteral elements: String ... ) {
30- guard elements. count == 2 else { fatalError ( " A ' \( Self . self) ' type can only be initialized with an array with two non-empty strings " ) }
27+ @_transparent public init ( arrayLiteral elements: String ... ) {
28+ precondition ( elements. count == 2 , " A ' \( API . self ) . \( Self . self) ' type can only be initialized with an array with two non-empty strings " )
3129 self . init ( . init( stringLiteral: elements [ 0 ] ) , . init( stringLiteral: elements [ 1 ] ) )
3230 }
3331 }
@@ -39,7 +37,7 @@ extension IG.API.User {
3937 public let rawValue : String
4038
4139 public init ( stringLiteral value: String ) {
42- guard Self . _validate ( value) else { fatalError ( " The username ' \( value) ' is not in a valid format " ) }
40+ precondition ( Self . _validate ( value) , " The username ' \( value) ' is not in a valid format " )
4341 self . rawValue = value
4442 }
4543
@@ -48,7 +46,7 @@ extension IG.API.User {
4846 self . rawValue = rawValue
4947 }
5048
51- @inlinable public init ? ( _ description: String ) {
49+ @_transparent public init ? ( _ description: String ) {
5250 self . init ( rawValue: description)
5351 }
5452
@@ -62,7 +60,7 @@ extension IG.API.User {
6260 self . rawValue = name
6361 }
6462
65- public static func < ( lhs: Self , rhs: Self ) -> Bool {
63+ @ _transparent public static func < ( lhs: Self , rhs: Self ) -> Bool {
6664 lhs. rawValue < rhs. rawValue
6765 }
6866
@@ -83,7 +81,7 @@ extension IG.API.User {
8381 public let rawValue : String
8482
8583 public init ( stringLiteral value: String ) {
86- guard Self . _validate ( value) else { fatalError ( " The password is not in a valid format " ) }
84+ precondition ( Self . _validate ( value) , " The password is not in a valid format " )
8785 self . rawValue = value
8886 }
8987
0 commit comments