Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
275 views

Swift Struct-based Factory Pattern

Edit: I added another configuration vector to CardView, a size attribute, which may be .small or ...
Richard Robinson's user avatar
1 vote
2 answers
264 views

Trying (and failing) to implement the best conventions on OOP Swift

I'm making a MacOS app that will do some analysis on the user's calendar data. For now it only supports Apple's native calendar (EventKit), but I will later add ...
Cornwell's user avatar
1 vote
3 answers
3k views

Create UIView programmatically in Swift

I am generating View and setting constraints programmatically in UIViewController ...
saurabh's user avatar
  • 166
2 votes
3 answers
211 views

I want to take away WebService call from UIViewController

I am using Moya to make network calls in Swift. In my ViewController I am calling the WebService and creating a model from response. ...
saurabh's user avatar
  • 166
3 votes
2 answers
473 views

Implement The Singleton Pattern for Persistency managers Swift [closed]

I am creating an iOS app and I want to implement Singleton Pattern. I have created "Singleton" LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a ...
NinjaDeveloper's user avatar
1 vote
0 answers
3k views

Swift/iOS component for label with clickable text buttons

So I'm creating a component based on UILabel, which I'm calling RichLabel. The main goal is to add support for clickable links (...
Eivind Lindbråten's user avatar
0 votes
1 answer
482 views

Simple networking layer in Swift using Strategy design pattern

Does the following code demonstrate proper use of Strategy design pattern for a simple networking layer in swift 3? Some code smells I'm unsure about: violates Single responsibiility principle. ...
AnonProgrammer's user avatar
3 votes
0 answers
144 views

Load data from WebAPI to the ViewController

My current code working perfectly, it is for data load from web api to the UIViewController (UITableView). But I am confused ...
Nazmul Hasan's user avatar
0 votes
2 answers
422 views

Swift inheritance versus composition

Say I'm using Parse Server and utilising the PFObject class from the iOS SDK. Say I want to have a Chat class. To use inheritance code (design 1): ...
silverdagger's user avatar
0 votes
1 answer
2k views

Singleton manager/service classes with mockable dependencies in swift

In our swift project, there are multiple service classes that encapsulate functions, mostly network-api calls. They implement a protocol, and depend on other service classes, e.g. an authorization ...
Falco Winkler's user avatar
3 votes
2 answers
586 views

Design Patterns in Swift: Mediator

I'm solving the following problem using the Mediator design pattern in Swift: Assume we track the location of all our mobile mechanics. We have noticed that there are times when a mobile mechanic ...
Reza Shirazian's user avatar
2 votes
1 answer
502 views

Design Patterns in Swift: Chain of Responsibility

I'm solving the following problem using the Chain Of Responsibility design pattern in Swift: Not all mechanics are created equally. Some mechanics are more experienced and can do more than others. ...
Reza Shirazian's user avatar
4 votes
1 answer
422 views

Observer design pattern in Swift

The problem: We have a set of mobile mechanics who are assigned specific zip codes. Each zip code has its own hourly rate. We want to increase and decrease these rates when the number of idle ...
Reza Shirazian's user avatar
10 votes
1 answer
248 views

Portfolio object made of Asset classes and Securities

I am learning Swift and object oriented programming. I am new to design patterns and protocol oriented programming. In my test code I have several related objects: ...
nico9T's user avatar
  • 225
8 votes
2 answers
11k views

Is this a correct use of using protocols and delegate pattern in Swift?

I am trying to grasp the concept of delegates and protocols in Swift. So I have implemented my own PlayableMedia protocol with two concrete classes ...
Amit Erandole's user avatar