swift4 Questions

5

Solved

I want to change clear button color to white. I have tried many ways but no luck.:( I also refer the following link. But it does not work for me. Please find below code which I have tried. I am ...
Maleki asked 17/5, 2018 at 5:10

5

The default UIPickerView color for text is black. There has been some updates to the language in Swift4. I have found my own solution and answered below.
Frigorific asked 25/1, 2018 at 20:47

8

Solved

I'm using Xcode 9.0. My pod file: pod 'Alamofire', '~> 4.3' pod 'SwiftyJSON' pod 'AlamofireSwiftyJSON' pod 'KSToastView', '0.5.7' pod 'SDWebImage', '~> 4.0' pod 'NVActivityIndicatorView' p...
Antemortem asked 8/9, 2018 at 4:46

5

Hy I am working on app that uses Realm and Alamofire. I am really happy in using these library in my iOS project. But then I have to post a List of models that contains multiple lists of models. ...
Shortchange asked 16/11, 2018 at 6:44

7

Should the use of class inheritance break the Decodability of class. For example, the following code class Server : Codable { var id : Int? } class Development : Server { var name : String? v...
Counterspy asked 14/6, 2017 at 20:13

2

I'm using Moya to communicate with my API. For many of my endpoints, I require that the user be authenticated (i.e. a bearer token is based in the Authorization header). In the Moya documentation,...
Transition asked 28/2, 2019 at 23:57

2

Solved

Is it possible to implement the Encodable and Decodable properties for UIColor When I try to add a Decodable extension I get an error extension UIColor : Decodable { public required init(from de...
Splanchnology asked 1/2, 2018 at 15:34

5

Solved

How come Apple can do this: import CoreGraphics import GameplayKit import simd /** @header SceneKit framework category additions related to GameplayKit integration. @copyright 2017 Apple, ...
Academic asked 21/6, 2017 at 11:14

2

Solved

I have a struct, which is my data model: import Foundation struct Item : Codable { var cat:String var name:String var createdAt:Date // more var itemIdentifier:UUID var completed:Bool func sav...
Meteoric asked 26/1, 2018 at 18:59

2

Solved

I have been trying to figure this out all day and yesterday night, but no luck. I can confirm that the LinkShareContent works but when I try to share a video file. It gives me an error code "reserv...
Golding asked 24/1, 2018 at 21:4

2

Solved

In testing how the new Codable interacts with NSCoding I have put together a playground test involving an NSCoding using Class that contains a Codable structure. To whit struct Unward: Codable { ...
Secessionist asked 7/6, 2018 at 16:57

16

Solved

Let's say I have Customer data type which contains a metadata property that can contains any JSON dictionary in the customer object struct Customer { let id: String let email: String let metada...
Eonism asked 17/6, 2017 at 10:3

4

Solved

I have a list of entries, that have an id, and I want to filter them down to ones that have an entry.id matching one of the ids in selectedIDs. Is there a way to do this with filter or do I have to...
Singular asked 15/10, 2018 at 6:53

2

Solved

Trying to get substring of String and append it to array of Strings: var stringToSplit = "TEST TEXT" var s = [String]() let subStr = anotherString[0 ..< 6] s.append(subStr) // <---- HERE I G...
Berkey asked 22/9, 2017 at 6:16

3

Solved

I have created a brand new core data model for my project and I want to create some NSManagedObject Subclasses for it. After generating subclasses XCode throws some errors that reference a path to ...
Fabricant asked 12/2, 2019 at 22:50

2

Solved

My Object conforms to the new Swift 4 Codeable protocol. How to save an array of these Objects in UserDefaults? struct MyObject: Codeable { var name: String var something: [String] } myObjectsA...
Modish asked 12/7, 2017 at 12:44

16

Solved

While using Swift4 and Codable protocols I got the following problem - it looks like there is no way to allow JSONDecoder to skip elements in an array. For example, I have the following JSON: [ {...
Magog asked 21/9, 2017 at 13:16

1

I am working on a simple Document macOS application in Xcode 9 / swift 4 using XIB for the interface. I have a TextView, the value of which I want to bind to a variable in the File's Owner's class...
Roice asked 15/10, 2017 at 15:12

3

Solved

It seems like in Swift 4.1 flatMap is deprecated. However there is a new method in Swift 4.1 compactMap which is doing the same thing? With flatMap you can transform each object in a collection, t...
Hindward asked 15/3, 2018 at 3:21

2

Solved

I am having trouble with the new observe API in Swift 4. player = AVPlayer() player?.observe(\.currentItem.status, options: [.new], changeHandler: { [weak self] (player, newValue) in if let statu...
Gwenora asked 24/9, 2018 at 8:40

6

Solved

This is using the example code from the official Swift4 doc let greeting = "Hi there! It's nice to meet you! đź‘‹" let endOfSentence = greeting.index(of: "!")! let firstSentence = greeting[...endOfS...
Vigilante asked 26/9, 2017 at 5:0

4

Solved

I am using Swift 4 and trying to parse some JSON data which apparently in some cases can have different type values for the same key, e.g.: { "type": 0.0 } and { "type": "12.44591406" } I ...
Lexeme asked 15/10, 2017 at 19:21

5

Solved

I want to change the navigation bar background colour, title font and colour programmatically in iOS 11 and swift 4 from AppDelegate. I know how to do it using Xcode but didn't find up-to-date solu...
Seringapatam asked 4/5, 2018 at 7:15

6

I am using this code snipped var htmlToAttributedString: NSAttributedString? { guard let data = data(using: .utf8) else { return NSAttributedString() } do { return try NSAttributedString(data...
Chuckle asked 25/9, 2018 at 6:20

4

Solved

I want to send a POST request to my php 7 server which accepts data as application/x-www-form-urlencoded. The data I have is inside a Struct and I want to get every property of this struct as a par...
Scheldt asked 10/2, 2018 at 12:46

© 2022 - 2025 — McMap. All rights reserved.