FMfred millot hinfredmillot.hashnode.dev·Sep 21, 2022 · 10 min readMock session with typealias URLSession.DatataskPublisher.OutputPurpose : For this example, an application uses a service to retrieve data from an API. This service uses the Combine framework. We will use the URLSession dataTaskPublisher which will publish the data (Output) when the task is completed, or an error...00
FMfred millot hinfredmillot.hashnode.dev·Aug 15, 2022 · 6 min readProtocol and Mock webServiceIn this example, an application uses data from an API. For the creation of the UI, we don't want to make a call at each simulation on device. Let's suppose that the back is not ready, or that we want to test a particular error case. So we will simul...00
FMfred millot hinfredmillot.hashnode.dev·Jun 15, 2022 · 2 min readResult typePurpose The response from a network call provides us with data or error. We recover fruits with the following model : struct FruitsResponse: Decodable { let results: [Fruit] } struct Fruit: Decodable, Equatable, Identifiable { let id: Int ...00
FMfred millot hinfredmillot.hashnode.dev·Dec 31, 2021 · 4 min readDecode a nested JSON structure with Swift DecodableIn a Json file, properties are often nested. This generates a longer or shorter path to the value. The access to this value can be direct with the use of containers. Example of a JSON file obtained with the OpenWeather API : { "coord": { ...00
FMfred millot hinfredmillot.hashnode.dev·Sep 19, 2021 · 3 min readConfiguration Selected Button StatePurpose : Use the isSelected property of UIButton, so that the button changes state when selected. Application : A set of digital buttons. The button number is white by default, and turns blue when the button is selected. Another set of operation b...00