Swift is a programming language designed by Apple for creating iOS and OS X apps. Swift builds upon the foundation of C and Objective-C.
2
votes
2answers
297 views
What did the reviewer refer to in this code review?
I sent the code for a job application and got the following review:
Regarding the Project Structure: Physical separation is absent.
Logical separation is present but not up to best practices. Things
...
0
votes
1answer
42 views
iOS: How to switch between prod and non prod REST end points
A noob iOS dev question: How do iOS developers develop their app with non prod REST URL endpoints while then using a prod REST URL endpoint for actual use by customers?
I'm not aware of a way you ...
0
votes
1answer
46 views
multiple api calls vs more complex apis
I have been providing a Web API (.NET MVC 5) of an Oracle Database to people who are making a mobile app. I have to admit that I am not very good at it. I have found that I can easily produce Data ...
1
vote
2answers
67 views
swift typealias vs empty inherited class
I am working on JSON model classes in a swift project. Examples of the sample JSON and classes are below. In the JSON response, there can be many different unique statistics returned, but they all ...
4
votes
1answer
87 views
Extension versus Delegation
I am using Swift and am wondering about the concepts of Extension and Delegation. Recently I found a case where either one of these two concepts could be applied. This reminded of the "composition ...
0
votes
1answer
108 views
Could this class be considered as a Factory class? [closed]
I've recently worked on a reusable network service class for a service-aggregator iOS app. This class should retry a failed request if it was caused by expired user token. Plus, this class will be ...
7
votes
4answers
215 views
Swift functions vs computed properties
Say I have have a class Event as follows:
class Event {
private var attendees: [Person] = []
// Case 1
//*******
// Should I use a func…
func countOfAttendees() -> Int {
...
1
vote
2answers
172 views
What does “Linux Ready” mean in the context of a project written in Swift?
There are few GitHub repositories written in Swift that are presented to be "Linux Ready". The Zewo organization has several repositories identified as "Linux Ready". What, exactly, does this mean?
3
votes
1answer
213 views
For what reasons would you use a separate class extension for each delegate in Swift?
I was working through a Ray Wenderlich tutorial and noticed that the author uses class extensions to hold delegate callbacks rather than having them be handled in the class itself i.e.:
delegate ...
1
vote
1answer
259 views
How should I handle the fetching of cached data in iOS
I'm developing an app at work, this is my first big application and in my smaller projects I didn't use caching at all.
What's currently happening
When the user logs on for their very first time ...
0
votes
1answer
71 views
Swift: Creating an empty array [closed]
The following:
var emptyArray = [String]();
What do I need the parentheses () for? [String] says, that the array accepts strings only. But why do I have to put the () there?
7
votes
2answers
800 views
Why does Swift not require semicolons? [closed]
I normally code in either c# or Objective-C and recently took it upon myself to learn Apple's new programming language - Swift.
The first thing I noticed is that you don't need to add semicolons to ...
-1
votes
1answer
93 views
Global counter using iOS and Parse? [closed]
I'm very new to Parse and trying to set up what is basically a voting app where I can collect data on how many times all users have pressed a button. I found some information on Atomic Increment ...
0
votes
0answers
68 views
How to ensure this constraint at compile time?
I have an interesting constraint/invariant and I would love to hear people's input on how to maintain it. Big bonus if it can be ensured at compile time...
I have the types below, and the following ...
1
vote
2answers
283 views
Testable design in Swift
I've been searching for so long about how to design testable classes in Swift but every information site just describe basic stuff like how to test, how to assert, why is testing good...
My current ...
3
votes
1answer
204 views
MVVM: Should the VM be a value type?
I have been recently strongly influenced by two lectures: Gary Bernhardt's "Boundaries" (https://www.destroyallsoftware.com/talks/boundaries) and Andy Matuschak's "Controlling Complexity" ...
35
votes
9answers
5k views
Why would a program use a closure?
After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure?
...
7
votes
3answers
5k views
How does garbage collection compare to reference counting? [duplicate]
I starting working through an online course on iOS development in the new language from Apple, Swift. The instructor made a point that raised this question in my mind. He said something to the ...
1
vote
1answer
196 views
Best architecure approach to develop iOS app
I'm trying to create a calendar app similar to this design: Calendar Design
I'm currently using this calendar framework: CVCalendar and it's working great, but my question is, what do you think is ...
1
vote
2answers
148 views
Is there a detriment to using SQLite over a pList for persistence?
I'm making a fairly simple application and I've got a settings menu that stores times and some boolean values. I have the application storing and retrieving data already but I started to wonder if ...
2
votes
1answer
267 views
Static properties and implicit “self” property in structures and enumerations vs classes in Swift
I am currently reading the Swift language documentation and came across these sentences in the chapter about methods:
Similarly, type methods on structures and enumerations can access
static ...
3
votes
1answer
739 views
Would I rather use Core Data or save files to the system?
I'm developing an iOS app which basically fetches a JSON from a remote location, parses it and instantiates classes for a couple of its elements. For some visualization, this should give you a basic ...
2
votes
3answers
533 views
Decorator design pattern in swift
Im reading "Head first design patterns" (here you can find exact example mentioned in book)
While going through Decorator design pattern, everything was crisp and clear until i stumbled into this
...
3
votes
1answer
237 views
Ways to do callback, when and where
I've recently started to do some more complicated programming with network-related work on iOS with Swift.
This introduced a lot of asynchronous code not only in networking but also some exchange of ...
1
vote
2answers
585 views
Workaround for unit testing Core Data in Swift
I am still pretty new to programming, but my first app was recently approved and is now for sale on the App Store. My app uses Core Data and is written in Swift. After some initial difficulties, I ...
5
votes
3answers
3k views
Using the optional 'self' reference in instance methods in Swift as a matter of style
Swift allows optional prefixing of method calls and property references to the current object instance via self. Removing these prefixes can declutter code but, depending on the length of the method ...
3
votes
1answer
1k views
Usage of MVVM in iOS
I'm an iOS developer and I'm guilty of having Massive View Controllers in my projects so I've been searching for a better way to structure my projects and came across the MVVM (Model-View-ViewModel) ...
11
votes
1answer
4k views
Swift Protocol Naming Conventions [closed]
Coming from a mainly c# background, I'm used to using the term "interface" for describing an object with no implementation that defines behaviour. In c#, the convention is to prepend interface names ...
28
votes
5answers
8k views
Why design a modern language without an exception-handling mechanism?
Many modern languages provide rich exception handling features, but Apple's Swift programming language does not provide an exception handling mechanism.
Steeped in exceptions as I am, I'm having ...
34
votes
2answers
4k views
Do modern languages still use parser generators?
I was researching about the gcc compiler suite on wikipedia here, when this came up:
GCC started out using LALR parsers generated with Bison, but gradually switched to hand-written ...
100
votes
5answers
48k views
How can Swift be so much faster than Objective-C in these comparisons?
Apple launched its new programming language Swift at WWDC14. In the presentation, they made some performance comparisons between Objective-C and Python. The following is a picture of one of their ...