All Questions
Tagged with swift object-oriented
23 questions
4
votes
2
answers
175
views
Swift String-extension 'countOccurrencesOfChar'
Loosely inspired by Ruby's String.count-method I wrote a similar Swift-method myself as an extension to the String-class. Then I had the idea to use a second parameter with which you can control if ...
1
vote
1
answer
65
views
"Pick up" images when tapped on and keep track of it
Trying to get my first job as a developer I made an app I was extremely proud of:
https://github.com/AnatolyRudenko/Crystals.Dragons
The game starts in a random room of a random maze. Some prebuilt ...
1
vote
2
answers
259
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 ...
1
vote
1
answer
157
views
Simple State Machine and Transition Table
The goal is to have well defined state transitions, and the ability to provide the next event to execute.
I'd like to know if this is a proper implementation of State Machine, considering how states ...
1
vote
1
answer
105
views
Initializing more than one instance object at a time in init method
I have a RadioStation class file and a view controller where I create two station objects based on this class, one for FM and one for AM.
I created both of these ...
3
votes
1
answer
89
views
Handle HTTP and BLE requests
Im implementing and designing a workflow that performs both HTTP and BLE requests.
Im having trouble figuring out the best approach to design a service to handle both types of requests, and manage ...
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 ...
2
votes
2
answers
1k
views
Formatting a price in Swift using an extension vs. a class
I have a price as a Double, which I should format it as a String.
Should I use an extension instead of classical class to ...
0
votes
2
answers
569
views
Design a system for creating a coffeeshop menu
During an interview I was asked to design the menu for a coffee shop employee so that the employee would go and add different items to the menu. This is the design that I came up with.
I just want ...
3
votes
1
answer
341
views
Dividing an arbitrary dollar amount into the fewest bills and coins
I am taking a class in mobile application development this fall. I have finished my first assignment of creating a class to divide an arbitrary dollar amount into the minimum number of bills and coins....
2
votes
1
answer
97
views
Classes for representing teleconferencing numbers
I'm developing an app that joins tele-conference calls so we use conference numbers a lot. I've got this basic structure to encapsulate the information regarding a conference number.
...
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 (...
1
vote
1
answer
2k
views
Swift/iOS: Subclassing UILabel and setting properties
I'm writing this subclass to add an icon to a UILabel. It works, but I'm wondering if this is the best/cleanest way to do it. Do you see any improvements? Should maybe ...
2
votes
1
answer
224
views
Extension vs Class For ViewModel
What the advantages & disadvantages to each of these approaches pertaining to creating file that takes care of the view configuration to reduce a controller's file size.
Main Purposes Are:
Memory
...
3
votes
1
answer
203
views
Swift Attempt To Reduce Massive View Controller
In an effort to reduce the size of a View Controller class I am wondering if this structure is an acceptable, safe way to modify the UI on a Controller Class.
The only thing that I see "wrong" with ...