Top "Swift4" questions

Use this tag only for questions directly related to changes in version 4 of Apple's Swift programming language.

What is difference between optional and decodeIfPresent when using Decodable for JSON Parsing?

I am using Codable protocol from Swift 4 first time, I am not able to understand use of decodeIfPresent from Decodable. /// …

swift swift4 codable decodable
Difference between flatMap and compactMap in Swift

It seems like in Swift 4.1 flatMap is deprecated. However there is a new method in Swift 4.1 compactMap which is doing …

swift swift4 swift4.1
does not conform to protocol Decodable / Codable

I'm using the following struct: struct Item : Codable { var category:String var birthDate:Date var switch:Bool var weightNew: [Weight] …

swift swift4
How to change the UIPickerView text color?

The default UIPickerView color for text is black. There has been some updates to the language in Swift4. I have …

uipickerview swift4
Encode nil value as null with JSONEncoder

I'm using Swift 4's JSONEncoder. I have a Codable struct with an optional property, and I'd like this property to …

ios json swift4 codable
iso8601 date json decoding using swift4

So, I've got iso8601 dates in my json which look like "2016-06-07T17:20:00.000+02:00" Is there a way to parse …

swift swift4
Can't import packages using Swift 4 Package Manager

Trying to test Swift 4 using Xcode-beta (v9) on my machine and having issues with importing packages into a test project: …

swift xcode macos package-managers swift4
How to do two concurrent API calls in swift 4

Thanks in advance for help, I have two API calls, both are concurrent and any call could be success first(…

ios swift4 nsoperationqueue nsoperation swift4.1
Swift Codable with dynamic keys

I have JSON structure as: "periods": { "2018-06-07": [ { "firstName": "Test1", "lastName": "Test1" } ], "2018-06-06": [ { "firstName": "Test1", "lastName": "Test1" } ] } I tried …

json swift swift4 codable
Using Alamofire and Codable for put request

I have a simple put request and I am using Alamofire's Parameters type to send data to the server. I …

json swift swift4 codable