= [:]
21 | private var iteratorCount = 0
22 |
23 | /// `OrderedDictionary` constructor.
24 | public init() {}
25 |
26 | /// Read only property that provides the number of elements in the `OrderedDictionary`.
27 | public var count: Int {
28 | get {
29 | return self.keys.count
30 | }
31 | }
32 |
33 | /// Provides a way to add and remove elements from the
34 | /// `OrderedDictionary`, just like any other `Dictionary`.
35 | ///
36 | /// Setting an element to nil will remove it from the `OrderedDictionary`.
37 | public subscript(key: K) -> V? {
38 | get {
39 | return self.values[key]
40 | }
41 | set(value) {
42 | if let new = value {
43 | let old = self.values.updateValue(new, forKey: key)
44 | if old == nil {
45 | self.keys.append(key)
46 | }
47 | self.iteratorCount = self.keys.count
48 | return
49 | }
50 | self.values.removeValue(forKey: key)
51 | self.keys = self.keys.filter {$0 != key}
52 | self.iteratorCount = self.keys.count
53 | return
54 | }
55 | }
56 |
57 | /// Return the element value at the numeric index specified.
58 | public subscript(index: Int) -> V? {
59 | if self.keys.indices.contains(index) {
60 | let key = self.keys[index]
61 | return self.values[key]
62 | }
63 | return nil
64 | }
65 |
66 | /// Read only property that provides a String containing the key:value pairs in the `OrderedDictionary`.
67 | public var description: String {
68 | var result = ""
69 | for (k, v) in self {
70 | result += "\(k): \(v)\n"
71 | }
72 | return result
73 | }
74 |
75 | }
76 |
77 | extension OrderedDictionary: Sequence, IteratorProtocol {
78 | /// Method to allow iteration over the contents of the
79 | /// `OrderedDictionary`. This method ensures that items are read in the same
80 | /// sequence as they were added.
81 | public mutating func next() -> (K, V)? {
82 | if self.iteratorCount == 0 {
83 | return nil
84 | } else {
85 | defer { self.iteratorCount -= 1 }
86 | let theKey = self.keys[self.keys.count - self.iteratorCount]
87 | let theValue = self.values[theKey]
88 | if let unwrappedValue = theValue {
89 | return(theKey, unwrappedValue)
90 | }
91 | return nil
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/docs/css/highlight.css:
--------------------------------------------------------------------------------
1 | /* Credit to https://gist.github.com/wataru420/2048287 */
2 | .highlight {
3 | /* Comment */
4 | /* Error */
5 | /* Keyword */
6 | /* Operator */
7 | /* Comment.Multiline */
8 | /* Comment.Preproc */
9 | /* Comment.Single */
10 | /* Comment.Special */
11 | /* Generic.Deleted */
12 | /* Generic.Deleted.Specific */
13 | /* Generic.Emph */
14 | /* Generic.Error */
15 | /* Generic.Heading */
16 | /* Generic.Inserted */
17 | /* Generic.Inserted.Specific */
18 | /* Generic.Output */
19 | /* Generic.Prompt */
20 | /* Generic.Strong */
21 | /* Generic.Subheading */
22 | /* Generic.Traceback */
23 | /* Keyword.Constant */
24 | /* Keyword.Declaration */
25 | /* Keyword.Pseudo */
26 | /* Keyword.Reserved */
27 | /* Keyword.Type */
28 | /* Literal.Number */
29 | /* Literal.String */
30 | /* Name.Attribute */
31 | /* Name.Builtin */
32 | /* Name.Class */
33 | /* Name.Constant */
34 | /* Name.Entity */
35 | /* Name.Exception */
36 | /* Name.Function */
37 | /* Name.Namespace */
38 | /* Name.Tag */
39 | /* Name.Variable */
40 | /* Operator.Word */
41 | /* Text.Whitespace */
42 | /* Literal.Number.Float */
43 | /* Literal.Number.Hex */
44 | /* Literal.Number.Integer */
45 | /* Literal.Number.Oct */
46 | /* Literal.String.Backtick */
47 | /* Literal.String.Char */
48 | /* Literal.String.Doc */
49 | /* Literal.String.Double */
50 | /* Literal.String.Escape */
51 | /* Literal.String.Heredoc */
52 | /* Literal.String.Interpol */
53 | /* Literal.String.Other */
54 | /* Literal.String.Regex */
55 | /* Literal.String.Single */
56 | /* Literal.String.Symbol */
57 | /* Name.Builtin.Pseudo */
58 | /* Name.Variable.Class */
59 | /* Name.Variable.Global */
60 | /* Name.Variable.Instance */
61 | /* Literal.Number.Integer.Long */ }
62 | .highlight .c {
63 | color: #999988;
64 | font-style: italic; }
65 | .highlight .err {
66 | color: #a61717;
67 | background-color: #e3d2d2; }
68 | .highlight .k {
69 | color: #000000;
70 | font-weight: bold; }
71 | .highlight .o {
72 | color: #000000;
73 | font-weight: bold; }
74 | .highlight .cm {
75 | color: #999988;
76 | font-style: italic; }
77 | .highlight .cp {
78 | color: #999999;
79 | font-weight: bold; }
80 | .highlight .c1 {
81 | color: #999988;
82 | font-style: italic; }
83 | .highlight .cs {
84 | color: #999999;
85 | font-weight: bold;
86 | font-style: italic; }
87 | .highlight .gd {
88 | color: #000000;
89 | background-color: #ffdddd; }
90 | .highlight .gd .x {
91 | color: #000000;
92 | background-color: #ffaaaa; }
93 | .highlight .ge {
94 | color: #000000;
95 | font-style: italic; }
96 | .highlight .gr {
97 | color: #aa0000; }
98 | .highlight .gh {
99 | color: #999999; }
100 | .highlight .gi {
101 | color: #000000;
102 | background-color: #ddffdd; }
103 | .highlight .gi .x {
104 | color: #000000;
105 | background-color: #aaffaa; }
106 | .highlight .go {
107 | color: #888888; }
108 | .highlight .gp {
109 | color: #555555; }
110 | .highlight .gs {
111 | font-weight: bold; }
112 | .highlight .gu {
113 | color: #aaaaaa; }
114 | .highlight .gt {
115 | color: #aa0000; }
116 | .highlight .kc {
117 | color: #000000;
118 | font-weight: bold; }
119 | .highlight .kd {
120 | color: #000000;
121 | font-weight: bold; }
122 | .highlight .kp {
123 | color: #000000;
124 | font-weight: bold; }
125 | .highlight .kr {
126 | color: #000000;
127 | font-weight: bold; }
128 | .highlight .kt {
129 | color: #445588; }
130 | .highlight .m {
131 | color: #009999; }
132 | .highlight .s {
133 | color: #d14; }
134 | .highlight .na {
135 | color: #008080; }
136 | .highlight .nb {
137 | color: #0086B3; }
138 | .highlight .nc {
139 | color: #445588;
140 | font-weight: bold; }
141 | .highlight .no {
142 | color: #008080; }
143 | .highlight .ni {
144 | color: #800080; }
145 | .highlight .ne {
146 | color: #990000;
147 | font-weight: bold; }
148 | .highlight .nf {
149 | color: #990000; }
150 | .highlight .nn {
151 | color: #555555; }
152 | .highlight .nt {
153 | color: #000080; }
154 | .highlight .nv {
155 | color: #008080; }
156 | .highlight .ow {
157 | color: #000000;
158 | font-weight: bold; }
159 | .highlight .w {
160 | color: #bbbbbb; }
161 | .highlight .mf {
162 | color: #009999; }
163 | .highlight .mh {
164 | color: #009999; }
165 | .highlight .mi {
166 | color: #009999; }
167 | .highlight .mo {
168 | color: #009999; }
169 | .highlight .sb {
170 | color: #d14; }
171 | .highlight .sc {
172 | color: #d14; }
173 | .highlight .sd {
174 | color: #d14; }
175 | .highlight .s2 {
176 | color: #d14; }
177 | .highlight .se {
178 | color: #d14; }
179 | .highlight .sh {
180 | color: #d14; }
181 | .highlight .si {
182 | color: #d14; }
183 | .highlight .sx {
184 | color: #d14; }
185 | .highlight .sr {
186 | color: #009926; }
187 | .highlight .s1 {
188 | color: #d14; }
189 | .highlight .ss {
190 | color: #990073; }
191 | .highlight .bp {
192 | color: #999999; }
193 | .highlight .vc {
194 | color: #008080; }
195 | .highlight .vg {
196 | color: #008080; }
197 | .highlight .vi {
198 | color: #008080; }
199 | .highlight .il {
200 | color: #009999; }
201 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/css/highlight.css:
--------------------------------------------------------------------------------
1 | /* Credit to https://gist.github.com/wataru420/2048287 */
2 | .highlight {
3 | /* Comment */
4 | /* Error */
5 | /* Keyword */
6 | /* Operator */
7 | /* Comment.Multiline */
8 | /* Comment.Preproc */
9 | /* Comment.Single */
10 | /* Comment.Special */
11 | /* Generic.Deleted */
12 | /* Generic.Deleted.Specific */
13 | /* Generic.Emph */
14 | /* Generic.Error */
15 | /* Generic.Heading */
16 | /* Generic.Inserted */
17 | /* Generic.Inserted.Specific */
18 | /* Generic.Output */
19 | /* Generic.Prompt */
20 | /* Generic.Strong */
21 | /* Generic.Subheading */
22 | /* Generic.Traceback */
23 | /* Keyword.Constant */
24 | /* Keyword.Declaration */
25 | /* Keyword.Pseudo */
26 | /* Keyword.Reserved */
27 | /* Keyword.Type */
28 | /* Literal.Number */
29 | /* Literal.String */
30 | /* Name.Attribute */
31 | /* Name.Builtin */
32 | /* Name.Class */
33 | /* Name.Constant */
34 | /* Name.Entity */
35 | /* Name.Exception */
36 | /* Name.Function */
37 | /* Name.Namespace */
38 | /* Name.Tag */
39 | /* Name.Variable */
40 | /* Operator.Word */
41 | /* Text.Whitespace */
42 | /* Literal.Number.Float */
43 | /* Literal.Number.Hex */
44 | /* Literal.Number.Integer */
45 | /* Literal.Number.Oct */
46 | /* Literal.String.Backtick */
47 | /* Literal.String.Char */
48 | /* Literal.String.Doc */
49 | /* Literal.String.Double */
50 | /* Literal.String.Escape */
51 | /* Literal.String.Heredoc */
52 | /* Literal.String.Interpol */
53 | /* Literal.String.Other */
54 | /* Literal.String.Regex */
55 | /* Literal.String.Single */
56 | /* Literal.String.Symbol */
57 | /* Name.Builtin.Pseudo */
58 | /* Name.Variable.Class */
59 | /* Name.Variable.Global */
60 | /* Name.Variable.Instance */
61 | /* Literal.Number.Integer.Long */ }
62 | .highlight .c {
63 | color: #999988;
64 | font-style: italic; }
65 | .highlight .err {
66 | color: #a61717;
67 | background-color: #e3d2d2; }
68 | .highlight .k {
69 | color: #000000;
70 | font-weight: bold; }
71 | .highlight .o {
72 | color: #000000;
73 | font-weight: bold; }
74 | .highlight .cm {
75 | color: #999988;
76 | font-style: italic; }
77 | .highlight .cp {
78 | color: #999999;
79 | font-weight: bold; }
80 | .highlight .c1 {
81 | color: #999988;
82 | font-style: italic; }
83 | .highlight .cs {
84 | color: #999999;
85 | font-weight: bold;
86 | font-style: italic; }
87 | .highlight .gd {
88 | color: #000000;
89 | background-color: #ffdddd; }
90 | .highlight .gd .x {
91 | color: #000000;
92 | background-color: #ffaaaa; }
93 | .highlight .ge {
94 | color: #000000;
95 | font-style: italic; }
96 | .highlight .gr {
97 | color: #aa0000; }
98 | .highlight .gh {
99 | color: #999999; }
100 | .highlight .gi {
101 | color: #000000;
102 | background-color: #ddffdd; }
103 | .highlight .gi .x {
104 | color: #000000;
105 | background-color: #aaffaa; }
106 | .highlight .go {
107 | color: #888888; }
108 | .highlight .gp {
109 | color: #555555; }
110 | .highlight .gs {
111 | font-weight: bold; }
112 | .highlight .gu {
113 | color: #aaaaaa; }
114 | .highlight .gt {
115 | color: #aa0000; }
116 | .highlight .kc {
117 | color: #000000;
118 | font-weight: bold; }
119 | .highlight .kd {
120 | color: #000000;
121 | font-weight: bold; }
122 | .highlight .kp {
123 | color: #000000;
124 | font-weight: bold; }
125 | .highlight .kr {
126 | color: #000000;
127 | font-weight: bold; }
128 | .highlight .kt {
129 | color: #445588; }
130 | .highlight .m {
131 | color: #009999; }
132 | .highlight .s {
133 | color: #d14; }
134 | .highlight .na {
135 | color: #008080; }
136 | .highlight .nb {
137 | color: #0086B3; }
138 | .highlight .nc {
139 | color: #445588;
140 | font-weight: bold; }
141 | .highlight .no {
142 | color: #008080; }
143 | .highlight .ni {
144 | color: #800080; }
145 | .highlight .ne {
146 | color: #990000;
147 | font-weight: bold; }
148 | .highlight .nf {
149 | color: #990000; }
150 | .highlight .nn {
151 | color: #555555; }
152 | .highlight .nt {
153 | color: #000080; }
154 | .highlight .nv {
155 | color: #008080; }
156 | .highlight .ow {
157 | color: #000000;
158 | font-weight: bold; }
159 | .highlight .w {
160 | color: #bbbbbb; }
161 | .highlight .mf {
162 | color: #009999; }
163 | .highlight .mh {
164 | color: #009999; }
165 | .highlight .mi {
166 | color: #009999; }
167 | .highlight .mo {
168 | color: #009999; }
169 | .highlight .sb {
170 | color: #d14; }
171 | .highlight .sc {
172 | color: #d14; }
173 | .highlight .sd {
174 | color: #d14; }
175 | .highlight .s2 {
176 | color: #d14; }
177 | .highlight .se {
178 | color: #d14; }
179 | .highlight .sh {
180 | color: #d14; }
181 | .highlight .si {
182 | color: #d14; }
183 | .highlight .sx {
184 | color: #d14; }
185 | .highlight .sr {
186 | color: #009926; }
187 | .highlight .s1 {
188 | color: #d14; }
189 | .highlight .ss {
190 | color: #990073; }
191 | .highlight .bp {
192 | color: #999999; }
193 | .highlight .vc {
194 | color: #008080; }
195 | .highlight .vg {
196 | color: #008080; }
197 | .highlight .vi {
198 | color: #008080; }
199 | .highlight .il {
200 | color: #009999; }
201 |
--------------------------------------------------------------------------------
/docs/search.json:
--------------------------------------------------------------------------------
1 | {"Structs/TypeDecoder.html#/s:11TypeDecoderAAV6decodeyAA0A4InfoOSe_pXpKFZ":{"name":"decode(_:)","abstract":"Returns a TypeInfo enum which describes the type passed in.
","parent_name":"TypeDecoder"},"Structs/TypeDecodingError.html#/s:11TypeDecoder0A13DecodingErrorV7contexts0cD0O7ContextVvp":{"name":"context","abstract":"A description of the error and the underlying error, which is of type DecodingError.
","parent_name":"TypeDecodingError"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVACyxq_Gycfc":{"name":"init()","abstract":"OrderedDictionary constructor.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV5countSivp":{"name":"count","abstract":"Read only property that provides the number of elements in the OrderedDictionary.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVyq_Sgxcip":{"name":"subscript(_:)","abstract":"Provides a way to add and remove elements from the","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVyq_SgSicip":{"name":"subscript(_:)","abstract":"
Return the element value at the numeric index specified.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV11descriptionSSvp":{"name":"description","abstract":"Read only property that provides a String containing the key:value pairs in the OrderedDictionary.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV4nextx_q_tSgyF":{"name":"next()","abstract":"Method to allow iteration over the contents of the","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html":{"name":"OrderedDictionary"},"Structs/TypeDecodingError.html":{"name":"TypeDecodingError","abstract":"
An Error type indicating a problem during decoding by the TypeDecoder .
"},"Structs/TypeDecoder.html":{"name":"TypeDecoder","abstract":"TypeDecoder allows you to decode a Swift type by using TypeDecoder.decode() and passing the type to"},"Protocols/ValidSingleCodingValueProvider.html#/s:11TypeDecoder30ValidSingleCodingValueProviderP05valideF0ypSgyFZ":{"name":"validCodingValue()","abstract":"
Returns a valid encoded representation of the conforming type.
","parent_name":"ValidSingleCodingValueProvider"},"Protocols/ValidKeyedCodingValueProvider.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","abstract":"Returns a value for a CodingKey that represents a field that","parent_name":"ValidKeyedCodingValueProvider"},"Protocols/ValidKeyedCodingValueProvider.html":{"name":"ValidKeyedCodingValueProvider","abstract":"
A protocol that your Codable type can adopt, in order to supply values"},"Protocols/ValidSingleCodingValueProvider.html":{"name":"ValidSingleCodingValueProvider","abstract":"
A protocol that your Codable type can adopt, in order to supply a"},"Extensions/UUID.html#/s:11TypeDecoder30ValidSingleCodingValueProviderP05valideF0ypSgyFZ":{"name":"validCodingValue()","parent_name":"UUID"},"Extensions/TimeZone.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","parent_name":"TimeZone"},"Extensions/URL.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","parent_name":"URL"},"Extensions/URL.html":{"name":"URL","abstract":"
Extension of the URL Foundation class that has validations to provide"},"Extensions/TimeZone.html":{"name":"TimeZone","abstract":"
Extension of the TimeZone Foundation class that has validations to provide"},"Extensions/UUID.html":{"name":"UUID","abstract":"
Extension of the UUID Foundation class that has validations to provide"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6singleyACypXp_ypXptcACmF":{"name":"single(_:_:)","abstract":"
Case representing a simple type, such as a String, which is not recursive.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO5keyedyACypXp_AA17OrderedDictionaryVySSACGtcACmF":{"name":"keyed(_:_:)","abstract":"Case representing a struct or a class containing the object type as","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO12dynamicKeyedyACypXp_A2CtcACmF":{"name":"dynamicKeyed(_:key:value:)","abstract":"
Case representing a Dictionary containing the top level type of the","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO7unkeyedyACypXp_ACtcACmF":{"name":"unkeyed(_:_:)","abstract":"
Case representing an Array containing the top level type of the array","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO8optionalyA2CcACmF":{"name":"optional(_:)","abstract":"
Case representing an Optional type containing its nested type.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6cyclicyACypXpcACmF":{"name":"cyclic(_:)","abstract":"Case representing a cyclic type so the associated type is the top level type.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6opaqueyACypXpcACmF":{"name":"opaque(_:)","abstract":"Case representing a type that could not be decoded.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:s28CustomDebugStringConvertibleP16debugDescriptionSSvp":{"name":"debugDescription","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/hashValue":{"name":"hashValue","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"TypeInfo"},"Enums/TypeInfo.html":{"name":"TypeInfo","abstract":"Main enum used to describe a decoded type.
"},"Enums.html":{"name":"Enumerations","abstract":"The following enumerations are available globally.
"},"Extensions.html":{"name":"Extensions","abstract":"The following extensions are available globally.
"},"Protocols.html":{"name":"Protocols","abstract":"The following protocols are available globally.
"},"Structs.html":{"name":"Structures","abstract":"The following structures are available globally.
"}}
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/search.json:
--------------------------------------------------------------------------------
1 | {"Structs/TypeDecoder.html#/s:11TypeDecoderAAV6decodeyAA0A4InfoOSe_pXpKFZ":{"name":"decode(_:)","abstract":"Returns a TypeInfo enum which describes the type passed in.
","parent_name":"TypeDecoder"},"Structs/TypeDecodingError.html#/s:11TypeDecoder0A13DecodingErrorV7contexts0cD0O7ContextVvp":{"name":"context","abstract":"A description of the error and the underlying error, which is of type DecodingError.
","parent_name":"TypeDecodingError"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVACyxq_Gycfc":{"name":"init()","abstract":"OrderedDictionary constructor.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV5countSivp":{"name":"count","abstract":"Read only property that provides the number of elements in the OrderedDictionary.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVyq_Sgxcip":{"name":"subscript(_:)","abstract":"Provides a way to add and remove elements from the","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryVyq_SgSicip":{"name":"subscript(_:)","abstract":"
Return the element value at the numeric index specified.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV11descriptionSSvp":{"name":"description","abstract":"Read only property that provides a String containing the key:value pairs in the OrderedDictionary.
","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html#/s:11TypeDecoder17OrderedDictionaryV4nextx_q_tSgyF":{"name":"next()","abstract":"Method to allow iteration over the contents of the","parent_name":"OrderedDictionary"},"Structs/OrderedDictionary.html":{"name":"OrderedDictionary"},"Structs/TypeDecodingError.html":{"name":"TypeDecodingError","abstract":"
An Error type indicating a problem during decoding by the TypeDecoder .
"},"Structs/TypeDecoder.html":{"name":"TypeDecoder","abstract":"TypeDecoder allows you to decode a Swift type by using TypeDecoder.decode() and passing the type to"},"Protocols/ValidSingleCodingValueProvider.html#/s:11TypeDecoder30ValidSingleCodingValueProviderP05valideF0ypSgyFZ":{"name":"validCodingValue()","abstract":"
Returns a valid encoded representation of the conforming type.
","parent_name":"ValidSingleCodingValueProvider"},"Protocols/ValidKeyedCodingValueProvider.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","abstract":"Returns a value for a CodingKey that represents a field that","parent_name":"ValidKeyedCodingValueProvider"},"Protocols/ValidKeyedCodingValueProvider.html":{"name":"ValidKeyedCodingValueProvider","abstract":"
A protocol that your Codable type can adopt, in order to supply values"},"Protocols/ValidSingleCodingValueProvider.html":{"name":"ValidSingleCodingValueProvider","abstract":"
A protocol that your Codable type can adopt, in order to supply a"},"Extensions/UUID.html#/s:11TypeDecoder30ValidSingleCodingValueProviderP05valideF0ypSgyFZ":{"name":"validCodingValue()","parent_name":"UUID"},"Extensions/TimeZone.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","parent_name":"TimeZone"},"Extensions/URL.html#/s:11TypeDecoder29ValidKeyedCodingValueProviderP05valideF06forKeyypSgs0eJ0_p_tFZ":{"name":"validCodingValue(forKey:)","parent_name":"URL"},"Extensions/URL.html":{"name":"URL","abstract":"
Extension of the URL Foundation class that has validations to provide"},"Extensions/TimeZone.html":{"name":"TimeZone","abstract":"
Extension of the TimeZone Foundation class that has validations to provide"},"Extensions/UUID.html":{"name":"UUID","abstract":"
Extension of the UUID Foundation class that has validations to provide"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6singleyACypXp_ypXptcACmF":{"name":"single(_:_:)","abstract":"
Case representing a simple type, such as a String, which is not recursive.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO5keyedyACypXp_AA17OrderedDictionaryVySSACGtcACmF":{"name":"keyed(_:_:)","abstract":"Case representing a struct or a class containing the object type as","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO12dynamicKeyedyACypXp_A2CtcACmF":{"name":"dynamicKeyed(_:key:value:)","abstract":"
Case representing a Dictionary containing the top level type of the","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO7unkeyedyACypXp_ACtcACmF":{"name":"unkeyed(_:_:)","abstract":"
Case representing an Array containing the top level type of the array","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO8optionalyA2CcACmF":{"name":"optional(_:)","abstract":"
Case representing an Optional type containing its nested type.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6cyclicyACypXpcACmF":{"name":"cyclic(_:)","abstract":"Case representing a cyclic type so the associated type is the top level type.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:11TypeDecoder0A4InfoO6opaqueyACypXpcACmF":{"name":"opaque(_:)","abstract":"Case representing a type that could not be decoded.
","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:s28CustomDebugStringConvertibleP16debugDescriptionSSvp":{"name":"debugDescription","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/hashValue":{"name":"hashValue","parent_name":"TypeInfo"},"Enums/TypeInfo.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"TypeInfo"},"Enums/TypeInfo.html":{"name":"TypeInfo","abstract":"Main enum used to describe a decoded type.
"},"Enums.html":{"name":"Enumerations","abstract":"The following enumerations are available globally.
"},"Extensions.html":{"name":"Extensions","abstract":"The following extensions are available globally.
"},"Protocols.html":{"name":"Protocols","abstract":"The following protocols are available globally.
"},"Structs.html":{"name":"Structures","abstract":"The following structures are available globally.
"}}
--------------------------------------------------------------------------------
/docs/Extensions/UUID.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | UUID Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | UUID Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
UUID
107 |
114 |
Extension of the UUID Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue () -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Extensions/UUID.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | UUID Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | UUID Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
UUID
107 |
114 |
Extension of the UUID Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue () -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/Extensions/URL.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | URL Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | URL Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
URL
107 |
114 |
Extension of the URL Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue ( forKey key : CodingKey ) -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/Extensions/TimeZone.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TimeZone Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TimeZone Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TimeZone
107 |
114 |
Extension of the TimeZone Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue ( forKey key : CodingKey ) -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Extensions/URL.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | URL Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | URL Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
URL
107 |
114 |
Extension of the URL Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue ( forKey key : CodingKey ) -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Extensions/TimeZone.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TimeZone Extension Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TimeZone Extension Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TimeZone
107 |
114 |
Extension of the TimeZone Foundation class that has validations to provide
115 | valid dummy values.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
Declaration
141 |
142 |
Swift
143 |
public static func validCodingValue ( forKey key : CodingKey ) -> Any ?
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/docs/Structs/TypeDecodingError.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TypeDecodingError Structure Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TypeDecodingError Structure Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TypeDecodingError
107 |
108 |
109 |
110 |
public struct TypeDecodingError : Error
111 |
112 |
113 |
114 |
An Error type indicating a problem during decoding by the TypeDecoder .
115 |
116 |
This type provides additional guidance for Decodable types that do not
117 | conform to either the ValidSingleCodingValueProvider or ValidKeyedCodingValueProvider
118 | protocols, suggesting that conformance may enable successful decoding.
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | context
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
A description of the error and the underlying error, which is of type DecodingError.
141 |
142 |
143 |
144 |
Declaration
145 |
146 |
Swift
147 |
public let context : DecodingError . Context
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/docs/Enums.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Enumerations Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | Enumerations Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
Enumerations
107 |
The following enumerations are available globally.
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
TypeInfo
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | TypeInfo
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
Main enum used to describe a decoded type.
139 |
140 |
See more
141 |
142 |
143 |
Declaration
144 |
145 |
Swift
146 |
public indirect enum TypeInfo
147 |
extension TypeInfo : CustomDebugStringConvertible
148 |
extension TypeInfo : CustomStringConvertible
149 |
extension TypeInfo : Hashable
150 |
extension TypeInfo : Equatable
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Structs/TypeDecodingError.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TypeDecodingError Structure Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TypeDecodingError Structure Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TypeDecodingError
107 |
108 |
109 |
110 |
public struct TypeDecodingError : Error
111 |
112 |
113 |
114 |
An Error type indicating a problem during decoding by the TypeDecoder .
115 |
116 |
This type provides additional guidance for Decodable types that do not
117 | conform to either the ValidSingleCodingValueProvider or ValidKeyedCodingValueProvider
118 | protocols, suggesting that conformance may enable successful decoding.
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | context
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
A description of the error and the underlying error, which is of type DecodingError.
141 |
142 |
143 |
144 |
Declaration
145 |
146 |
Swift
147 |
public let context : DecodingError . Context
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Enums.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Enumerations Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | Enumerations Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
Enumerations
107 |
The following enumerations are available globally.
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
TypeInfo
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | TypeInfo
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
Main enum used to describe a decoded type.
139 |
140 |
See more
141 |
142 |
143 |
Declaration
144 |
145 |
Swift
146 |
public indirect enum TypeInfo
147 |
extension TypeInfo : CustomDebugStringConvertible
148 |
extension TypeInfo : CustomStringConvertible
149 |
extension TypeInfo : Hashable
150 |
extension TypeInfo : Equatable
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/docs/Structs/TypeDecoder.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TypeDecoder Structure Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TypeDecoder Structure Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TypeDecoder
107 |
108 |
109 |
110 |
public struct TypeDecoder
111 |
112 |
113 |
114 |
TypeDecoder allows you to decode a Swift type by using TypeDecoder.decode() and passing the type to
115 | be decoded.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
Returns a TypeInfo enum which describes the type passed in.
138 |
Usage Example:
139 |
struct StructureType : Decodable {
140 | let aString : String
141 | }
142 |
143 | let structureTypeInfo = try TypeDecoder . decode ( StructureType . self )
144 |
145 |
146 |
147 |
148 |
Declaration
149 |
150 |
Swift
151 |
public static func decode ( _ type : Decodable . Type ) throws -> TypeInfo
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/Tests/TypeDecoderTests/TypeDecodingErrorTests.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import XCTest
3 | @testable import TypeDecoder
4 |
5 | class TypeDecodingErrorTests: XCTestCase {
6 |
7 | static var allTests = [
8 | ("testDecodeErrorSingle", testDecodeErrorSingle),
9 | ("testDecodeErrorValidSingle", testDecodeErrorValidSingle),
10 | ("testDecodeValidSingleSuccess", testDecodeValidSingleSuccess),
11 | ("testDecodeErrorKeyed", testDecodeErrorKeyed),
12 | ("testDecodeErrorValidKeyed", testDecodeErrorValidKeyed),
13 | ("testDecodeValidKeyedSuccess", testDecodeValidKeyedSuccess),
14 | ]
15 |
16 | // A simple Codable enum with String raw value. The TypeDecoder cannot
17 | // handle this as-is, and decoding is expected to fail.
18 | enum CodableEnum: String, Codable {
19 | case foo,bar
20 | }
21 |
22 | // A simple Codable enum with String raw value, with conformance to
23 | // ValidSingleCodingValueProvider in order to provide a value. The value
24 | // provided in this case is invalid (decoding should fail).
25 | enum CodableValidEnumFail: String, Codable, ValidSingleCodingValueProvider {
26 | case foo,bar
27 | static func validCodingValue() -> Any? {
28 | return "fail"
29 | }
30 | }
31 |
32 | // A simple Codable enum with String raw value, with conformance to
33 | // ValidSingleCodingValueProvider in order to provide a value. The value
34 | // provided in this case is acceptable (decoding should succeed).
35 | enum CodableValidEnum: String, Codable, ValidSingleCodingValueProvider {
36 | case foo,bar
37 | static func validCodingValue() -> Any? {
38 | return self.foo.rawValue
39 | }
40 | }
41 |
42 | // A Codable struct with a validated String field. The TypeDecoder cannot
43 | // handle this as-is, and decoding is expected to fail.
44 | struct CodableKeyed: Codable {
45 | let foo: String
46 | public init(from decoder: Decoder) throws {
47 | let container = try decoder.container(keyedBy: CodingKeys.self)
48 | self.foo = try container.decode(String.self, forKey: CodingKeys.foo)
49 | guard self.foo == "Foo" else {
50 | throw DecodingError.dataCorruptedError(forKey: CodingKeys.foo, in: container, debugDescription: "Not Foo")
51 | }
52 | }
53 | }
54 |
55 | // A Codable struct with a validated String field, with conformance to
56 | // ValidKeyedCodingValueProvider in order to provide a value. The value
57 | // provided in this case is invalid (decoding should fail).
58 | struct CodableValidKeyedFail: Codable, ValidKeyedCodingValueProvider {
59 | static func validCodingValue(forKey key: CodingKey) -> Any? {
60 | return "Bar"
61 | }
62 |
63 | let foo: String
64 | public init(from decoder: Decoder) throws {
65 | let container = try decoder.container(keyedBy: CodingKeys.self)
66 | self.foo = try container.decode(String.self, forKey: CodingKeys.foo)
67 | guard self.foo == "Foo" else {
68 | throw DecodingError.dataCorruptedError(forKey: CodingKeys.foo, in: container, debugDescription: "Not Foo")
69 | }
70 | }
71 | }
72 |
73 | // A Codable struct with a validated String field, with conformance to
74 | // ValidKeyedCodingValueProvider in order to provide a value. The value
75 | // provided in this case is acceptable (decoding should succeed).
76 | struct CodableValidKeyed: Codable, ValidKeyedCodingValueProvider {
77 | static func validCodingValue(forKey key: CodingKey) -> Any? {
78 | switch key.stringValue {
79 | case self.CodingKeys.foo.stringValue:
80 | return "Foo"
81 | default:
82 | return nil
83 | }
84 | }
85 |
86 | let foo: String
87 | public init(from decoder: Decoder) throws {
88 | let container = try decoder.container(keyedBy: CodingKeys.self)
89 | self.foo = try container.decode(String.self, forKey: CodingKeys.foo)
90 | guard self.foo == "Foo" else {
91 | throw DecodingError.dataCorruptedError(forKey: CodingKeys.foo, in: container, debugDescription: "Not Foo")
92 | }
93 | }
94 | }
95 |
96 | // Test that decoding a SingleValue type which performs validation
97 | // fails with a TypeDecodingError with Symptom.noValueProvided
98 | func testDecodeErrorSingle() {
99 | do {
100 | let typeInfo = try TypeDecoder.decode(CodableEnum.self)
101 | XCTFail("Expected a TypeDecodingError but unexpectedly succeeded: \(typeInfo.debugDescription)")
102 | } catch let error as TypeDecodingError {
103 | XCTAssertEqual(error.symptom, TypeDecodingError.Symptom.noValueProvided)
104 | } catch {
105 | XCTFail("Expected a TypeDecodingError but received: \(error)")
106 | }
107 | }
108 |
109 | // Test that decoding a SingleValue type which performs validation,
110 | // and provides an invalid dummy value via ValidSingleCodingValueProvider
111 | // fails with a TypeDecodingError with Symptom.invalidSingleValue
112 | func testDecodeErrorValidSingle() {
113 | do {
114 | let typeInfo = try TypeDecoder.decode(CodableValidEnumFail.self)
115 | XCTFail("Expected a TypeDecodingError but unexpectedly succeeded: \(typeInfo.debugDescription)")
116 | } catch let error as TypeDecodingError {
117 | XCTAssertEqual(error.symptom, TypeDecodingError.Symptom.invalidSingleValue)
118 | } catch {
119 | XCTFail("Expected a TypeDecodingError but received: \(error)")
120 | }
121 | }
122 |
123 | // Test that decoding a SingleValue type which performs validation,
124 | // and provides an acceptable dummy value via ValidSingleCodingValueProvider
125 | // succeeds.
126 | func testDecodeValidSingleSuccess() {
127 | do {
128 | let typeInfo = try TypeDecoder.decode(CodableValidEnum.self)
129 | XCTAssertEqual(typeInfo, .single(String.self, String.self))
130 | } catch {
131 | XCTFail("Expected decoding to succeed, but received: \(error)")
132 | }
133 | }
134 |
135 | // Test that decoding a Keyed type which performs validation fails
136 | // with a TypeDecodingError with Symptom.noValueProvided
137 | func testDecodeErrorKeyed() {
138 | do {
139 | let typeInfo = try TypeDecoder.decode(CodableKeyed.self)
140 | XCTFail("Expected a TypeDecodingError but unexpectedly succeeded: \(typeInfo.debugDescription)")
141 | } catch let error as TypeDecodingError {
142 | XCTAssertEqual(error.symptom, TypeDecodingError.Symptom.noValueProvided)
143 | } catch {
144 | XCTFail("Expected a TypeDecodingError but received: \(error)")
145 | }
146 | }
147 |
148 | // Test that decoding a Keyed type which performs validation, and
149 | // provides an invalid dummy value via ValidKeyedCodingValueProvider
150 | // fails with a TypeDecodingError with Symptom.invalidKeyedValue
151 | func testDecodeErrorValidKeyed() {
152 | do {
153 | let typeInfo = try TypeDecoder.decode(CodableValidKeyedFail.self)
154 | XCTFail("Expected a TypeDecodingError but unexpectedly succeeded: \(typeInfo.debugDescription)")
155 | } catch let error as TypeDecodingError {
156 | XCTAssertEqual(error.symptom, TypeDecodingError.Symptom.invalidKeyedValue)
157 | } catch {
158 | XCTFail("Expected a TypeDecodingError but received: \(error)")
159 | }
160 | }
161 |
162 | // Test that decoding a Keyed type which performs validation, and
163 | // provides an acceptable dummy value via ValidKeyedCodingValueProvider
164 | // succeeds.
165 | func testDecodeValidKeyedSuccess() {
166 | do {
167 | let typeInfo = try TypeDecoder.decode(CodableValidKeyed.self)
168 | switch typeInfo {
169 | case .keyed(let type, _):
170 | XCTAssertTrue(type is CodableValidKeyed.Type, "Expected type to be \(CodableValidKeyed.self) but was: \(type)")
171 | default:
172 | XCTFail("Expected decode of keyed type, but was: \(typeInfo.debugDescription)")
173 | }
174 | } catch {
175 | XCTFail("Expected decoding to succeed, but received: \(error)")
176 | }
177 | }
178 |
179 | }
180 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Structs/TypeDecoder.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TypeDecoder Structure Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | TypeDecoder Structure Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
TypeDecoder
107 |
108 |
109 |
110 |
public struct TypeDecoder
111 |
112 |
113 |
114 |
TypeDecoder allows you to decode a Swift type by using TypeDecoder.decode() and passing the type to
115 | be decoded.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
132 |
133 |
134 |
135 |
136 |
137 |
Returns a TypeInfo enum which describes the type passed in.
138 |
Usage Example:
139 |
struct StructureType : Decodable {
140 | let aString : String
141 | }
142 |
143 | let structureTypeInfo = try TypeDecoder . decode ( StructureType . self )
144 |
145 |
146 |
147 |
148 |
Declaration
149 |
150 |
Swift
151 |
public static func decode ( _ type : Decodable . Type ) throws -> TypeInfo
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/docs/Protocols/ValidSingleCodingValueProvider.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ValidSingleCodingValueProvider Protocol Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | ValidSingleCodingValueProvider Protocol Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
ValidSingleCodingValueProvider
107 |
108 |
109 |
110 |
public protocol ValidSingleCodingValueProvider
111 |
112 |
113 |
114 |
A protocol that your Codable type can adopt, in order to supply a
115 | valid value during decoding. This protocol is suitable for types that
116 | are represented by a single encoded value, such as an enum.
117 |
118 |
The TypeDecoder operates by constructing a ‘dummy’ instance of a type,
119 | via the init(from: Decoder) initializer. As there is no real data to
120 | be decoded, a dummy value (such as 0 or "") is provided. This
121 | may cause an initializer that requires a specific valid value to fail.
122 |
123 |
To enable such a type to work with TypeDecoder, define an extension
124 | that conforms the type to the ValidSingleCodingValueProvider protocol.
125 | The validCodingValue() function should return a valid encoded
126 | representation of that type.
127 |
Usage Example:
128 |
public enum Fruit : String , Codable {
129 | case apple , banana , orange , pear
130 | }
131 |
132 | // Provide an acceptable value during decoding
133 | extension Fruit : ValidSingleCodingValueProvider {
134 | public static func validCodingValue () -> Any ? {
135 | // Returns the string "apple"
136 | return self . apple . rawValue
137 | }
138 | }
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
156 |
157 |
158 |
159 |
160 |
161 |
Returns a valid encoded representation of the conforming type.
162 |
Usage Example:
163 |
self . apple . rawValue
164 |
165 |
166 |
167 |
168 |
Declaration
169 |
170 |
Swift
171 |
static func validCodingValue () -> Any ?
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
189 |
190 |
191 |
192 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Protocols/ValidSingleCodingValueProvider.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ValidSingleCodingValueProvider Protocol Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | ValidSingleCodingValueProvider Protocol Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
ValidSingleCodingValueProvider
107 |
108 |
109 |
110 |
public protocol ValidSingleCodingValueProvider
111 |
112 |
113 |
114 |
A protocol that your Codable type can adopt, in order to supply a
115 | valid value during decoding. This protocol is suitable for types that
116 | are represented by a single encoded value, such as an enum.
117 |
118 |
The TypeDecoder operates by constructing a ‘dummy’ instance of a type,
119 | via the init(from: Decoder) initializer. As there is no real data to
120 | be decoded, a dummy value (such as 0 or "") is provided. This
121 | may cause an initializer that requires a specific valid value to fail.
122 |
123 |
To enable such a type to work with TypeDecoder, define an extension
124 | that conforms the type to the ValidSingleCodingValueProvider protocol.
125 | The validCodingValue() function should return a valid encoded
126 | representation of that type.
127 |
Usage Example:
128 |
public enum Fruit : String , Codable {
129 | case apple , banana , orange , pear
130 | }
131 |
132 | // Provide an acceptable value during decoding
133 | extension Fruit : ValidSingleCodingValueProvider {
134 | public static func validCodingValue () -> Any ? {
135 | // Returns the string "apple"
136 | return self . apple . rawValue
137 | }
138 | }
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
156 |
157 |
158 |
159 |
160 |
161 |
Returns a valid encoded representation of the conforming type.
162 |
Usage Example:
163 |
self . apple . rawValue
164 |
165 |
166 |
167 |
168 |
Declaration
169 |
170 |
Swift
171 |
static func validCodingValue () -> Any ?
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
189 |
190 |
191 |
192 |
--------------------------------------------------------------------------------
/docs/css/jazzy.css:
--------------------------------------------------------------------------------
1 | *, *:before, *:after {
2 | box-sizing: inherit; }
3 |
4 | body {
5 | margin: 0;
6 | background: #fff;
7 | color: #333;
8 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
9 | letter-spacing: .2px;
10 | -webkit-font-smoothing: antialiased;
11 | box-sizing: border-box; }
12 |
13 | h1 {
14 | font-size: 2rem;
15 | font-weight: 700;
16 | margin: 1.275em 0 0.6em; }
17 |
18 | h2 {
19 | font-size: 1.75rem;
20 | font-weight: 700;
21 | margin: 1.275em 0 0.3em; }
22 |
23 | h3 {
24 | font-size: 1.5rem;
25 | font-weight: 700;
26 | margin: 1em 0 0.3em; }
27 |
28 | h4 {
29 | font-size: 1.25rem;
30 | font-weight: 700;
31 | margin: 1.275em 0 0.85em; }
32 |
33 | h5 {
34 | font-size: 1rem;
35 | font-weight: 700;
36 | margin: 1.275em 0 0.85em; }
37 |
38 | h6 {
39 | font-size: 1rem;
40 | font-weight: 700;
41 | margin: 1.275em 0 0.85em;
42 | color: #777; }
43 |
44 | p {
45 | margin: 0 0 1em; }
46 |
47 | ul, ol {
48 | padding: 0 0 0 2em;
49 | margin: 0 0 0.85em; }
50 |
51 | blockquote {
52 | margin: 0 0 0.85em;
53 | padding: 0 15px;
54 | color: #858585;
55 | border-left: 4px solid #e5e5e5; }
56 |
57 | img {
58 | max-width: 100%; }
59 |
60 | a {
61 | color: #4183c4;
62 | text-decoration: none; }
63 | a:hover, a:focus {
64 | outline: 0;
65 | text-decoration: underline; }
66 | a.discouraged {
67 | text-decoration: line-through; }
68 | a.discouraged:hover, a.discouraged:focus {
69 | text-decoration: underline line-through; }
70 |
71 | table {
72 | background: #fff;
73 | width: 100%;
74 | border-collapse: collapse;
75 | border-spacing: 0;
76 | overflow: auto;
77 | margin: 0 0 0.85em; }
78 |
79 | tr:nth-child(2n) {
80 | background-color: #fbfbfb; }
81 |
82 | th, td {
83 | padding: 6px 13px;
84 | border: 1px solid #ddd; }
85 |
86 | pre {
87 | margin: 0 0 1.275em;
88 | padding: .85em 1em;
89 | overflow: auto;
90 | background: #f7f7f7;
91 | font-size: .85em;
92 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
93 |
94 | code {
95 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
96 |
97 | .item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
98 | background: #f7f7f7;
99 | padding: .2em; }
100 | .item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
101 | letter-spacing: -.2em;
102 | content: "\00a0"; }
103 |
104 | pre code {
105 | padding: 0;
106 | white-space: pre; }
107 |
108 | .content-wrapper {
109 | display: flex;
110 | flex-direction: column; }
111 | @media (min-width: 768px) {
112 | .content-wrapper {
113 | flex-direction: row; } }
114 | .header {
115 | display: flex;
116 | padding: 8px;
117 | font-size: 0.875em;
118 | background: #444;
119 | color: #999; }
120 |
121 | .header-col {
122 | margin: 0;
123 | padding: 0 8px; }
124 |
125 | .header-col--primary {
126 | flex: 1; }
127 |
128 | .header-link {
129 | color: #fff; }
130 |
131 | .header-icon {
132 | padding-right: 6px;
133 | vertical-align: -4px;
134 | height: 16px; }
135 |
136 | .breadcrumbs {
137 | font-size: 0.875em;
138 | padding: 8px 16px;
139 | margin: 0;
140 | background: #fbfbfb;
141 | border-bottom: 1px solid #ddd; }
142 |
143 | .carat {
144 | height: 10px;
145 | margin: 0 5px; }
146 |
147 | .navigation {
148 | order: 2; }
149 | @media (min-width: 768px) {
150 | .navigation {
151 | order: 1;
152 | width: 25%;
153 | max-width: 300px;
154 | padding-bottom: 64px;
155 | overflow: hidden;
156 | word-wrap: normal;
157 | background: #fbfbfb;
158 | border-right: 1px solid #ddd; } }
159 | .nav-groups {
160 | list-style-type: none;
161 | padding-left: 0; }
162 |
163 | .nav-group-name {
164 | border-bottom: 1px solid #ddd;
165 | padding: 8px 0 8px 16px; }
166 |
167 | .nav-group-name-link {
168 | color: #333; }
169 |
170 | .nav-group-tasks {
171 | margin: 8px 0;
172 | padding: 0 0 0 8px; }
173 |
174 | .nav-group-task {
175 | font-size: 1em;
176 | list-style-type: none;
177 | white-space: nowrap; }
178 |
179 | .nav-group-task-link {
180 | color: #808080; }
181 |
182 | .main-content {
183 | order: 1; }
184 | @media (min-width: 768px) {
185 | .main-content {
186 | order: 2;
187 | flex: 1;
188 | padding-bottom: 60px; } }
189 | .section {
190 | padding: 0 32px;
191 | border-bottom: 1px solid #ddd; }
192 |
193 | .section-content {
194 | max-width: 834px;
195 | margin: 0 auto;
196 | padding: 16px 0; }
197 |
198 | .section-name {
199 | color: #666;
200 | display: block; }
201 | .section-name p {
202 | margin-bottom: inherit; }
203 |
204 | .declaration .highlight {
205 | overflow-x: initial;
206 | padding: 8px 0;
207 | margin: 0;
208 | background-color: transparent;
209 | border: none; }
210 |
211 | .task-group-section {
212 | border-top: 1px solid #ddd; }
213 |
214 | .task-group {
215 | padding-top: 0px; }
216 |
217 | .task-name-container a[name]:before {
218 | content: "";
219 | display: block; }
220 |
221 | .section-name-container {
222 | position: relative; }
223 | .section-name-container .section-name-link {
224 | position: absolute;
225 | top: 0;
226 | left: 0;
227 | bottom: 0;
228 | right: 0;
229 | margin-bottom: 0; }
230 | .section-name-container .section-name {
231 | position: relative;
232 | pointer-events: none;
233 | z-index: 1; }
234 | .section-name-container .section-name a {
235 | pointer-events: auto; }
236 |
237 | .item-container {
238 | padding: 0; }
239 |
240 | .item {
241 | padding-top: 8px;
242 | width: 100%;
243 | list-style-type: none; }
244 | .item a[name]:before {
245 | content: "";
246 | display: block; }
247 | .item .token, .item .direct-link {
248 | display: inline-block;
249 | text-indent: -20px;
250 | padding-left: 3px;
251 | margin-left: 20px;
252 | font-size: 1rem; }
253 | .item .declaration-note {
254 | font-size: .85em;
255 | color: #808080;
256 | font-style: italic; }
257 |
258 | .pointer-container {
259 | border-bottom: 1px solid #ddd;
260 | left: -23px;
261 | padding-bottom: 13px;
262 | position: relative;
263 | width: 110%; }
264 |
265 | .pointer {
266 | left: 21px;
267 | top: 7px;
268 | display: block;
269 | position: absolute;
270 | width: 12px;
271 | height: 12px;
272 | border-left: 1px solid #ddd;
273 | border-top: 1px solid #ddd;
274 | background: #fff;
275 | transform: rotate(45deg); }
276 |
277 | .height-container {
278 | display: none;
279 | position: relative;
280 | width: 100%;
281 | overflow: hidden; }
282 | .height-container .section {
283 | background: #fff;
284 | border: 1px solid #ddd;
285 | border-top-width: 0;
286 | padding-top: 10px;
287 | padding-bottom: 5px;
288 | padding: 8px 16px; }
289 |
290 | .aside, .language {
291 | padding: 6px 12px;
292 | margin: 12px 0;
293 | border-left: 5px solid #dddddd;
294 | overflow-y: hidden; }
295 | .aside .aside-title, .language .aside-title {
296 | font-size: 9px;
297 | letter-spacing: 2px;
298 | text-transform: uppercase;
299 | padding-bottom: 0;
300 | margin: 0;
301 | color: #aaa;
302 | -webkit-user-select: none; }
303 | .aside p:last-child, .language p:last-child {
304 | margin-bottom: 0; }
305 |
306 | .language {
307 | border-left: 5px solid #cde9f4; }
308 | .language .aside-title {
309 | color: #4183c4; }
310 |
311 | .aside-warning, .aside-deprecated, .aside-unavailable {
312 | border-left: 5px solid #ff6666; }
313 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
314 | color: #ff0000; }
315 |
316 | .graybox {
317 | border-collapse: collapse;
318 | width: 100%; }
319 | .graybox p {
320 | margin: 0;
321 | word-break: break-word;
322 | min-width: 50px; }
323 | .graybox td {
324 | border: 1px solid #ddd;
325 | padding: 5px 25px 5px 10px;
326 | vertical-align: middle; }
327 | .graybox tr td:first-of-type {
328 | text-align: right;
329 | padding: 7px;
330 | vertical-align: top;
331 | word-break: normal;
332 | width: 40px; }
333 |
334 | .slightly-smaller {
335 | font-size: 0.9em; }
336 |
337 | .footer {
338 | padding: 8px 16px;
339 | background: #444;
340 | color: #ddd;
341 | font-size: 0.8em; }
342 | .footer p {
343 | margin: 8px 0; }
344 | .footer a {
345 | color: #fff; }
346 |
347 | html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
348 | display: none; }
349 |
350 | html.dash .height-container {
351 | display: block; }
352 |
353 | form[role=search] input {
354 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
355 | font-size: 14px;
356 | line-height: 24px;
357 | padding: 0 10px;
358 | margin: 0;
359 | border: none;
360 | border-radius: 1em; }
361 | .loading form[role=search] input {
362 | background: white url(../img/spinner.gif) center right 4px no-repeat; }
363 |
364 | form[role=search] .tt-menu {
365 | margin: 0;
366 | min-width: 300px;
367 | background: #fbfbfb;
368 | color: #333;
369 | border: 1px solid #ddd; }
370 |
371 | form[role=search] .tt-highlight {
372 | font-weight: bold; }
373 |
374 | form[role=search] .tt-suggestion {
375 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
376 | padding: 0 8px; }
377 | form[role=search] .tt-suggestion span {
378 | display: table-cell;
379 | white-space: nowrap; }
380 | form[role=search] .tt-suggestion .doc-parent-name {
381 | width: 100%;
382 | text-align: right;
383 | font-weight: normal;
384 | font-size: 0.9em;
385 | padding-left: 16px; }
386 |
387 | form[role=search] .tt-suggestion:hover,
388 | form[role=search] .tt-suggestion.tt-cursor {
389 | cursor: pointer;
390 | background-color: #4183c4;
391 | color: #fff; }
392 |
393 | form[role=search] .tt-suggestion:hover .doc-parent-name,
394 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
395 | color: #fff; }
396 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/css/jazzy.css:
--------------------------------------------------------------------------------
1 | *, *:before, *:after {
2 | box-sizing: inherit; }
3 |
4 | body {
5 | margin: 0;
6 | background: #fff;
7 | color: #333;
8 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
9 | letter-spacing: .2px;
10 | -webkit-font-smoothing: antialiased;
11 | box-sizing: border-box; }
12 |
13 | h1 {
14 | font-size: 2rem;
15 | font-weight: 700;
16 | margin: 1.275em 0 0.6em; }
17 |
18 | h2 {
19 | font-size: 1.75rem;
20 | font-weight: 700;
21 | margin: 1.275em 0 0.3em; }
22 |
23 | h3 {
24 | font-size: 1.5rem;
25 | font-weight: 700;
26 | margin: 1em 0 0.3em; }
27 |
28 | h4 {
29 | font-size: 1.25rem;
30 | font-weight: 700;
31 | margin: 1.275em 0 0.85em; }
32 |
33 | h5 {
34 | font-size: 1rem;
35 | font-weight: 700;
36 | margin: 1.275em 0 0.85em; }
37 |
38 | h6 {
39 | font-size: 1rem;
40 | font-weight: 700;
41 | margin: 1.275em 0 0.85em;
42 | color: #777; }
43 |
44 | p {
45 | margin: 0 0 1em; }
46 |
47 | ul, ol {
48 | padding: 0 0 0 2em;
49 | margin: 0 0 0.85em; }
50 |
51 | blockquote {
52 | margin: 0 0 0.85em;
53 | padding: 0 15px;
54 | color: #858585;
55 | border-left: 4px solid #e5e5e5; }
56 |
57 | img {
58 | max-width: 100%; }
59 |
60 | a {
61 | color: #4183c4;
62 | text-decoration: none; }
63 | a:hover, a:focus {
64 | outline: 0;
65 | text-decoration: underline; }
66 | a.discouraged {
67 | text-decoration: line-through; }
68 | a.discouraged:hover, a.discouraged:focus {
69 | text-decoration: underline line-through; }
70 |
71 | table {
72 | background: #fff;
73 | width: 100%;
74 | border-collapse: collapse;
75 | border-spacing: 0;
76 | overflow: auto;
77 | margin: 0 0 0.85em; }
78 |
79 | tr:nth-child(2n) {
80 | background-color: #fbfbfb; }
81 |
82 | th, td {
83 | padding: 6px 13px;
84 | border: 1px solid #ddd; }
85 |
86 | pre {
87 | margin: 0 0 1.275em;
88 | padding: .85em 1em;
89 | overflow: auto;
90 | background: #f7f7f7;
91 | font-size: .85em;
92 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
93 |
94 | code {
95 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
96 |
97 | .item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
98 | background: #f7f7f7;
99 | padding: .2em; }
100 | .item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
101 | letter-spacing: -.2em;
102 | content: "\00a0"; }
103 |
104 | pre code {
105 | padding: 0;
106 | white-space: pre; }
107 |
108 | .content-wrapper {
109 | display: flex;
110 | flex-direction: column; }
111 | @media (min-width: 768px) {
112 | .content-wrapper {
113 | flex-direction: row; } }
114 | .header {
115 | display: flex;
116 | padding: 8px;
117 | font-size: 0.875em;
118 | background: #444;
119 | color: #999; }
120 |
121 | .header-col {
122 | margin: 0;
123 | padding: 0 8px; }
124 |
125 | .header-col--primary {
126 | flex: 1; }
127 |
128 | .header-link {
129 | color: #fff; }
130 |
131 | .header-icon {
132 | padding-right: 6px;
133 | vertical-align: -4px;
134 | height: 16px; }
135 |
136 | .breadcrumbs {
137 | font-size: 0.875em;
138 | padding: 8px 16px;
139 | margin: 0;
140 | background: #fbfbfb;
141 | border-bottom: 1px solid #ddd; }
142 |
143 | .carat {
144 | height: 10px;
145 | margin: 0 5px; }
146 |
147 | .navigation {
148 | order: 2; }
149 | @media (min-width: 768px) {
150 | .navigation {
151 | order: 1;
152 | width: 25%;
153 | max-width: 300px;
154 | padding-bottom: 64px;
155 | overflow: hidden;
156 | word-wrap: normal;
157 | background: #fbfbfb;
158 | border-right: 1px solid #ddd; } }
159 | .nav-groups {
160 | list-style-type: none;
161 | padding-left: 0; }
162 |
163 | .nav-group-name {
164 | border-bottom: 1px solid #ddd;
165 | padding: 8px 0 8px 16px; }
166 |
167 | .nav-group-name-link {
168 | color: #333; }
169 |
170 | .nav-group-tasks {
171 | margin: 8px 0;
172 | padding: 0 0 0 8px; }
173 |
174 | .nav-group-task {
175 | font-size: 1em;
176 | list-style-type: none;
177 | white-space: nowrap; }
178 |
179 | .nav-group-task-link {
180 | color: #808080; }
181 |
182 | .main-content {
183 | order: 1; }
184 | @media (min-width: 768px) {
185 | .main-content {
186 | order: 2;
187 | flex: 1;
188 | padding-bottom: 60px; } }
189 | .section {
190 | padding: 0 32px;
191 | border-bottom: 1px solid #ddd; }
192 |
193 | .section-content {
194 | max-width: 834px;
195 | margin: 0 auto;
196 | padding: 16px 0; }
197 |
198 | .section-name {
199 | color: #666;
200 | display: block; }
201 | .section-name p {
202 | margin-bottom: inherit; }
203 |
204 | .declaration .highlight {
205 | overflow-x: initial;
206 | padding: 8px 0;
207 | margin: 0;
208 | background-color: transparent;
209 | border: none; }
210 |
211 | .task-group-section {
212 | border-top: 1px solid #ddd; }
213 |
214 | .task-group {
215 | padding-top: 0px; }
216 |
217 | .task-name-container a[name]:before {
218 | content: "";
219 | display: block; }
220 |
221 | .section-name-container {
222 | position: relative; }
223 | .section-name-container .section-name-link {
224 | position: absolute;
225 | top: 0;
226 | left: 0;
227 | bottom: 0;
228 | right: 0;
229 | margin-bottom: 0; }
230 | .section-name-container .section-name {
231 | position: relative;
232 | pointer-events: none;
233 | z-index: 1; }
234 | .section-name-container .section-name a {
235 | pointer-events: auto; }
236 |
237 | .item-container {
238 | padding: 0; }
239 |
240 | .item {
241 | padding-top: 8px;
242 | width: 100%;
243 | list-style-type: none; }
244 | .item a[name]:before {
245 | content: "";
246 | display: block; }
247 | .item .token, .item .direct-link {
248 | display: inline-block;
249 | text-indent: -20px;
250 | padding-left: 3px;
251 | margin-left: 20px;
252 | font-size: 1rem; }
253 | .item .declaration-note {
254 | font-size: .85em;
255 | color: #808080;
256 | font-style: italic; }
257 |
258 | .pointer-container {
259 | border-bottom: 1px solid #ddd;
260 | left: -23px;
261 | padding-bottom: 13px;
262 | position: relative;
263 | width: 110%; }
264 |
265 | .pointer {
266 | left: 21px;
267 | top: 7px;
268 | display: block;
269 | position: absolute;
270 | width: 12px;
271 | height: 12px;
272 | border-left: 1px solid #ddd;
273 | border-top: 1px solid #ddd;
274 | background: #fff;
275 | transform: rotate(45deg); }
276 |
277 | .height-container {
278 | display: none;
279 | position: relative;
280 | width: 100%;
281 | overflow: hidden; }
282 | .height-container .section {
283 | background: #fff;
284 | border: 1px solid #ddd;
285 | border-top-width: 0;
286 | padding-top: 10px;
287 | padding-bottom: 5px;
288 | padding: 8px 16px; }
289 |
290 | .aside, .language {
291 | padding: 6px 12px;
292 | margin: 12px 0;
293 | border-left: 5px solid #dddddd;
294 | overflow-y: hidden; }
295 | .aside .aside-title, .language .aside-title {
296 | font-size: 9px;
297 | letter-spacing: 2px;
298 | text-transform: uppercase;
299 | padding-bottom: 0;
300 | margin: 0;
301 | color: #aaa;
302 | -webkit-user-select: none; }
303 | .aside p:last-child, .language p:last-child {
304 | margin-bottom: 0; }
305 |
306 | .language {
307 | border-left: 5px solid #cde9f4; }
308 | .language .aside-title {
309 | color: #4183c4; }
310 |
311 | .aside-warning, .aside-deprecated, .aside-unavailable {
312 | border-left: 5px solid #ff6666; }
313 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
314 | color: #ff0000; }
315 |
316 | .graybox {
317 | border-collapse: collapse;
318 | width: 100%; }
319 | .graybox p {
320 | margin: 0;
321 | word-break: break-word;
322 | min-width: 50px; }
323 | .graybox td {
324 | border: 1px solid #ddd;
325 | padding: 5px 25px 5px 10px;
326 | vertical-align: middle; }
327 | .graybox tr td:first-of-type {
328 | text-align: right;
329 | padding: 7px;
330 | vertical-align: top;
331 | word-break: normal;
332 | width: 40px; }
333 |
334 | .slightly-smaller {
335 | font-size: 0.9em; }
336 |
337 | .footer {
338 | padding: 8px 16px;
339 | background: #444;
340 | color: #ddd;
341 | font-size: 0.8em; }
342 | .footer p {
343 | margin: 8px 0; }
344 | .footer a {
345 | color: #fff; }
346 |
347 | html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
348 | display: none; }
349 |
350 | html.dash .height-container {
351 | display: block; }
352 |
353 | form[role=search] input {
354 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
355 | font-size: 14px;
356 | line-height: 24px;
357 | padding: 0 10px;
358 | margin: 0;
359 | border: none;
360 | border-radius: 1em; }
361 | .loading form[role=search] input {
362 | background: white url(../img/spinner.gif) center right 4px no-repeat; }
363 |
364 | form[role=search] .tt-menu {
365 | margin: 0;
366 | min-width: 300px;
367 | background: #fbfbfb;
368 | color: #333;
369 | border: 1px solid #ddd; }
370 |
371 | form[role=search] .tt-highlight {
372 | font-weight: bold; }
373 |
374 | form[role=search] .tt-suggestion {
375 | font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
376 | padding: 0 8px; }
377 | form[role=search] .tt-suggestion span {
378 | display: table-cell;
379 | white-space: nowrap; }
380 | form[role=search] .tt-suggestion .doc-parent-name {
381 | width: 100%;
382 | text-align: right;
383 | font-weight: normal;
384 | font-size: 0.9em;
385 | padding-left: 16px; }
386 |
387 | form[role=search] .tt-suggestion:hover,
388 | form[role=search] .tt-suggestion.tt-cursor {
389 | cursor: pointer;
390 | background-color: #4183c4;
391 | color: #fff; }
392 |
393 | form[role=search] .tt-suggestion:hover .doc-parent-name,
394 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
395 | color: #fff; }
396 |
--------------------------------------------------------------------------------
/docs/Extensions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Extensions Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | Extensions Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
Extensions
107 |
The following extensions are available globally.
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
Validation
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | URL
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
Extension of the URL Foundation class that has validations to provide
139 | valid dummy values.
140 |
141 |
See more
142 |
143 |
144 |
Declaration
145 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 | TimeZone
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
Extension of the TimeZone Foundation class that has validations to provide
168 | valid dummy values.
169 |
170 |
See more
171 |
172 |
173 |
Declaration
174 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 | UUID
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
Extension of the UUID Foundation class that has validations to provide
197 | valid dummy values.
198 |
199 |
See more
200 |
201 |
202 |
Declaration
203 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
223 |
224 |
225 |
226 |
--------------------------------------------------------------------------------
/docs/docsets/TypeDecoder.docset/Contents/Resources/Documents/Extensions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Extensions Reference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
43 |
44 |
45 | TypeDecoder Reference
46 |
47 | Extensions Reference
48 |
49 |
50 |
51 |
52 |
101 |
102 |
103 |
104 |
105 |
106 |
Extensions
107 |
The following extensions are available globally.
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
Validation
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | URL
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
Extension of the URL Foundation class that has validations to provide
139 | valid dummy values.
140 |
141 |
See more
142 |
143 |
144 |
Declaration
145 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 | TimeZone
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
Extension of the TimeZone Foundation class that has validations to provide
168 | valid dummy values.
169 |
170 |
See more
171 |
172 |
173 |
Declaration
174 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 | UUID
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
Extension of the UUID Foundation class that has validations to provide
197 | valid dummy values.
198 |
199 |
See more
200 |
201 |
202 |
Declaration
203 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
223 |
224 |
225 |
226 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------