swift4 Questions

9

Solved

I just declared an entity called "Users" array: var UsersArray = [Users]() I got this error: use of unresolved identifiers "Users" hint : I did import CoreData and created the entity
Rudiment asked 31/10, 2019 at 22:21

3

Could you briefly explain what @objc and dynamic mean in Swift 4 using Xcode 9.x? With tries and errors and following articles in the stackoverflow, I have eventually achieved this snippet to work...
Wig asked 1/2, 2018 at 9:52

15

my project uses both Objective-C and Swift code. When a user logs in, it calls a set of apis for user preference, I have a DataCoordinator.swift class which schedules the API operation and I make t...
Callup asked 31/7, 2017 at 12:25

4

Solved

I'm trying to create an internal function for the String class to get only AlphaNumeric characters and return a string. I'm running into a few errors with how to convert the matches back into a str...
Obsessive asked 28/8, 2018 at 7:30

8

Solved

Swift 4 added the new Codable protocol. When I use JSONDecoder it seems to require all the non-optional properties of my Codable class to have keys in the JSON or it throws an error. Making every ...
Annalee asked 15/6, 2017 at 19:18

6

Solved

struct Task: Codable { var content: String var deadline: Date var color: UIColor ... } There are warnings saying "Type 'Task' does not conform to protocol 'Decodable'" and "Type 'Task' does no...
Suzan asked 19/6, 2018 at 12:12

2

Solved

Let's say I'm writing a swift module, and I want to name a type with a name which already exists. If the name is from another module, it's easy. I can just use the module name as a namespace: impo...
Osteo asked 18/9, 2017 at 7:57

9

Solved

However I have recompiled the framework using the same Xcode and it still gives me this error. Base SDK iOS 11.1 for both Swift Language Version Swift 4.0 for both Not using Pods/Carthage I ho...
Retrieve asked 13/10, 2017 at 8:53

2

Solved

I have the following code (EDIT: Updated the code so everyone can compile it and see): import UIKit struct Action { let text: String let handler: (() -> Void)? } class AlertView : UIView { ...
Faeroese asked 26/2, 2018 at 20:4

4

Solved

I have an EmailVerificationStatus enum with an associated type of String that conforms to the Codable protocol: enum EmailVerificationStatus: String, Codable { case unverified case verified } ...
Escrow asked 3/9, 2017 at 14:1

1

Solved

Creating an application for image and video processing, where app requirement is set device Orientation according to selected video content orientation from the gallery. So I have used some line of...
Kalil asked 14/12, 2017 at 9:16

12

Solved

Why am I getting a "Type 'Bookmark' does not conform to protocol 'Decodable'" error message? class Bookmark: Codable { weak var publication: Publication? var indexPath: [Int] var locationInText...
Bessbessarabia asked 1/2, 2018 at 17:19

9

Solved

In Swift 4, I'm getting this error when I try to take a Substring of a String using subscript syntax. 'subscript' is unavailable: cannot subscript String with a CountableClosedRange, see the doc...
Serpasil asked 4/8, 2017 at 3:12

21

Solved

I have the following simple code written in Swift 3: let str = "Hello, playground" let index = str.index(of: ",")! let newStr = str.substring(to: index) From Xcode 9 beta 5, I get the following ...
Portecochere asked 8/8, 2017 at 8:4

5

Solved

I'm trying to find the best way to Encode/Decode an array of structs conforming to a swift protocol using the new JSONDecoder/Encoder in Swift 4. I made up a little example to illustrate the probl...
Peregrination asked 8/6, 2017 at 16:34

4

Solved

Is it possible to extend NSDecimalNumber to conform Encodable & Decodable protocols?
Criseyde asked 19/9, 2017 at 7:43

4

Solved

I have razor pay pod in my project for payment gateway and SWRevelViewController file for side bar controller. I selected the swift 5 and iOS version 13 and updated all the pods but still getting e...
Grissel asked 11/3, 2020 at 5:18

3

Solved

Swift 3.0 I know that fileprivate access level modifier limited using of function/property to source file where it was declared and private - limited to lexical scope where was declared. But it se...
Hisakohisbe asked 7/4, 2017 at 21:17

3

Solved

in Swift4, the String is Collections. You will no longer use characters property on a string. func swapCharacters(input:String,index1:Int,index2:Int)-> String { // logic to swap } let in...
Dunaville asked 26/12, 2017 at 17:42

7

Solved

let url = URL(string: "https://example.com") let path = "/somePath?" let urlWithPath = url?.appendingPathComponent(path) After appending, the path /somePath? becomes somePath%3F. The ? becomes a...
Peruzzi asked 28/12, 2018 at 7:34

3

I am using xcode version 10.1 and swift 4 I want to add a new dependency https://github.com/IBM-Swift/BlueECC/blob/master/README.md to my existing project I am following the below steps to install...
Dishevel asked 26/9, 2019 at 5:30

2

I basically want to have an optional completion handler that has no parameters that are passed back. Here is what I have so far but obviously it is wrong. func refreshAccountData(type:String, com...
Notepaper asked 14/2, 2018 at 20:27

3

Solved

I'm going through some projects and removing JSON parsing frameworks, as it seems pretty simple to do with Swift 4. I've encountered this oddball JSON return where Ints and Dates are returned as St...
Rufinaruford asked 24/10, 2017 at 2:51

4

I am trying to figure this out. When I use the code below, I am able to move from one text field to the next and click the "Backspace" button but ONLY when the text field has text in there. My Qu...
Micheal asked 20/4, 2018 at 7:23

8

Solved

Swift 4 has Codable and it's awesome. But UIImage does not conform to it by default. How can we do that? I tried with singleValueContainer and unkeyedContainer extension UIImage: Codable { // 'r...
Failsafe asked 13/9, 2017 at 12:36

© 2022 - 2024 — McMap. All rights reserved.