FWJSON
struct FWJSON
This class is reponsible to get the JSON and transform in data.
-
Initializes the structure’s data instance with the passed URL parameter.
Declaration
Swift
public init(bundleURL url: URL) throws
Parameters
url
An URL type parameter that will be used to instaciate a Data var.
-
Initializes the structure’s data instance with the passed data parameter.
Declaration
Swift
init(data: Data)
Parameters
data
An Data type parameter that will be used for decoding.
-
Tries to decode the JSON into a generic type and return as success completion case a generic type to create our form.
completionHandler: Returns an generic structure on sucess and a generic error on failure.
Declaration
Swift
func decode<T>(completionHandler: @escaping (_ result: Result<T, Error>) -> Void) where T : Decodable
Parameters
result
Enum containing the results of the operation.
-
Tries to decode the JSON into a form structure type and return as a success completion case a FWFormData to create our form.
completionHandler: Returns an FWFormData structure on sucess and a generic error on failure.
Declaration
Swift
func decode(completionHandler: @escaping (_ result: Result<FWFormModel, Error>) -> Void)
Parameters
result
Enum containing the results of the operation.
-
Tries to decode the JSON into a component and return as a completion case a FWComponent.
- completionHandler: Returns an FWComponentData on sucess and a generic error on failure
Declaration
Swift
func decode(completionHandler: @escaping (_ result: Result<FWComponentModel, Error>) -> Void)
Parameters
result
Enum containing the results of the operation.