swift4.1 Questions
3
Solved
Thanks in advance for help,
I have two API calls, both are concurrent and any call could be success first(I don't want call in sequence), after success of both calls, I have to stop my activity ind...
Klaraklarika asked 27/5, 2018 at 23:32
3
I have tried:
restart the simulator and Xcode
delete Xcode and reinstall it
run xcrun simctl erase all this command
I already try but can't solve this issue
6
Solved
I’m getting strange error while building project in Xcode 9.4
Build system information - unexpected service error: The Xcode build system has crashed. Please close and reopen your workspace.
I...
Spit asked 15/6, 2018 at 7:15
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...
1
Solved
Swift 4.2 has a special condition canImport that helps developers to check whether a module can be imported in project. It was introduced in Swift 4.1.
Now I am working on iOS project written in O...
Neutrality asked 2/10, 2018 at 9:8
2
I get Overriding non-@objc declarations from extensions is not supported error when subclass UIImage with custom init after upgrading to Swift 4.1
class Foo: UIImage {
init(bar: String) { }
re...
6
Solved
I get the above runtime message after I upgraded to Swift4.1 and Xcode 9.3. Before the upgrade I did not have this message in my console window.
Status bar could not find cached time string imag...
1
The issues is cause by setting a custom color in the storyboard,its not related to custom font.
Step 1: Define color in Assets Folder
Step 2: Set that color as label text color
Step 3: Chang...
5
Solved
How can we call class functions with a dynamic class name?
Assume the following example where I have two class with methods with same signature
class Foo{
class func doSomething()
}
class Foob...
1
This code sample was working in a macOS playground:
import Cocoa
import XCPlayground
func getResImg(name: String, ext: String) -> CIImage {
guard let fileURL = Bundle.main.url(forResource: n...
Birchard asked 6/6, 2018 at 14:29
1
Solved
I have
@IBOutlet weak var messageTextView: UITextView
and I want that when there is a change inside the text then print to console: blabla.
I tried to add the following function, but when I ch...
2
Solved
Consider this code snippet:
var a: String? = "abc"
var b: String?
let result = [a, b].compactMap { $0 }
After executing it, result will be
["abc"]
which is the expected result. The element o...
1
I'm getting this warning in Xcode when I run my app in the simulator. What can I do to get rid of it?
objc[6529]: Class VCWeakObjectHolder is implemented in both /Applications/Xcode.app/Contents/D...
1
Solved
I am running a code with webRTC. I am not posting code because I really don't know the point where it is getting crashed. It is almost thousands of lines of code. I want to know where exactly the c...
Outlet asked 15/6, 2018 at 10:49
2
Solved
How do I rotate a SpriteNode with a one finger “touch and drag” so that:
It doesn’t jerk around
It moves in a circle (I’ve successfully accomplished this part several times- both with a code only...
Republican asked 24/3, 2018 at 1:59
4
After updating to Xcode 9.3 (which uses Swift 4.1), the following issue was found:
Create an empty project, add a new .swift file to it and create two new classes:
class CodableOne: Codable {...
1
Solved
Can someone explain why @objc keyword is needed here to compile the code?
As I understood this keyword is used in order to work ObjC message method dispatch. But this is not an NSObject instance.
...
1
Solved
In Swift standard document by Apple :
func printInfo(_ value: Any) {
let type = type(of: value)
print("'\(value)' of type '\(type)'")
}
and it give an error : Variable used within its own init...
1
The code below works in Xcode 9.2 (Swift 4.0) but gives an error in Xcode 9.3 (Swift 4.1).
let dict: [String: Any] = [
"status_code": 5,
"status_message": "message"
]
let data = try! JSONEncode...
1
In the former version, to get a float value from a [String: Any] dictionary, I can use let float = dict["somekey"] as? Float, but in swift4.1, it doesn't work. It seems the type of dict["somekey"] ...
3
Solved
I am getting a JSON string from the server (or file).
I want to parse that JSON string and dynamically figure out each of the value types.
However, when it comes to boolean values, JSONSerializat...
1
Solved
1
Solved
I've been saying this to form a C array of CGPoint:
let arr = UnsafeMutablePointer<CGPoint>.allocate(capacity:4)
defer {
arr.deinitialize()
arr.deallocate(capacity:4)
}
arr[0] = CGPoint(x:...
Michaeline asked 1/2, 2018 at 19:22
1
© 2022 - 2024 — McMap. All rights reserved.