Global web icon
stackoverflow.com
https://stackoverflow.com/questions/26835013/what-…
ios - What is "self" used for in Swift? - Stack Overflow
I am new to Swift and I'm wondering what self is used for and why. I have seen it in classes and structures but I really don't find them essential nor necessary to even mention them in my code. Wh...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/70962534/swift…
Swift await/async - how to wait synchronously for an async task to ...
77 I'm bridging the sync/async worlds in Swift and doing incremental adoption of async/await. I'm trying to invoke an async function that returns a value from a non async function. I understand that explicit use of Task is the way to do that, as described, for instance, here. The example doesn't really fit as that task doesn't return a value.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/24032754/how-d…
How does one declare optional methods in a Swift protocol?
415 In Swift 2 and onwards it's possible to add default implementations of a protocol. This creates a new way of optional methods in protocols.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/24043589/null-…
null / nil in Swift - Stack Overflow
8 Swift’s nil is not the same as nil in Objective-C. In Objective-C, nil is a pointer to a non-existent object. In Swift, nil is not a pointer—it is the absence of a value of a certain type. Optionals of any type can be set to nil, not just object types. NULL has no equivalent in Swift. nil is also called nil in Swift Nil has no equivalent ...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/32256834/swift…
swift2 - Swift: guard let vs if let - Stack Overflow
The Swift Docs on Control Flow explain the idea behind that: Using a guard statement for requirements improves the readability of your code, compared to doing the same check with an if statement.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/35316655/how-t…
ios - How to format localised strings in Swift? - Stack Overflow
How to format localised strings in Swift? Asked 9 years, 9 months ago Modified 9 months ago Viewed 40k times
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/27338573/round…
Rounding a double value to x number of decimal places in swift
The nature of Swift's Double appears to be that it can be imprecise – because of the way it's stored/accessed in binary, even using this rounding function will not return a number rounded to 3 decimal places: e.g., round(8.46 * pow(10.0, 3.0)) / pow(10.0, 3.0) returns 8.460000000000001.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/24200888/swift…
Swift - How to replace characters in a String? - Stack Overflow
I am looking for a way to replace characters in a Swift String. In this example String: "This is my string" I would like to replace the spaces, " ", with "+" to end up...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/24051314/preci…
Precision string format specifier in Swift - Stack Overflow
Precision string format specifier in Swift Asked 11 years, 6 months ago Modified 8 months ago Viewed 437k times
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/24551816/swift…
ios - Swift - encode URL - Stack Overflow
98 Swift 4 & 5 To encode a parameter in URL I find using .alphanumerics character set the easiest option: