Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, iPadOS, macOS, watchOS, tvOS, Linux, and z/OS.
3
votes
Accepted
Convert String to Integer (calculator app)
You had the right idea to use to encapsulate the variables and operations in a class object or struct, rather than using the global scope. It was not clear why this did not work for you.
To make thin …
2
votes
Accepted
Can this Swift code be simplified?
Optional chaining can be used to condense the check into a single line.
Example:
let name_cache = NSCache<NSString, NSString>()
if let name = name_cache.object(forKey: "name") ?? (dictionary["name"] …
1
vote
Accepted
UIViewController without interfacebuilder
viewController.view
view.addSubview(oneWayView)
// Add constraints to position the oneWayView...
}
}
On the other hand, if you prefer to stick to your original plans, you could use Swift …
1
vote
Accepted
Parser to extract calendar data
Static constructors generally do lead to the problems you have encountered, where the implementation tends to be procedural, and complexity increases as the constructed classes become more intricate.
…
1
vote
Accepted
Making a TableViewDataSource more independent of the data it utilizes
My concern is that my TableViewDataSource is too tightly coupled with having to know about how my Conductor class functions, and I could like to decouple some of the logic.
Create a protocol whic …
1
vote
REST API client
This is mostly a clean and well considered design. Some opportunities for improvement which stand out:
Make the baseURL property a parameter of the initialiser for RestApiManager. This will allow you …
1
vote
Accepted
Amplitude and Frequencies of sound Analyser
This is mostly correct. The reasoning for using delegates is that the class should inform its delegate, not instruct it. A symptom of this is that SoundAnalyser is formatting the text, which should be …
0
votes
Background execution in iOS
A slightly simpler approach would be to add an extension onto UIApplication itself, for executing a function in the background.
Pros:
No extra classes are needed.
The callback syntax is simpler.
Th …