Questions tagged [ios]
iOS is an operating system for mobile devices developed by Apple Inc. that is currently used in their iPhone, iPod touch, iPad, and Apple TV (2nd generation) devices. It shares a lot with Mac OS X, but is optimized for touch-based interfaces. Use this tag for questions about iOS-specific code.
398
questions
0
votes
0
answers
25
views
Show a list of downloads
I've been working on a Swift project that involves a seedbox app for my NAS, and I would appreciate some feedback on the code structure and especially on the placement of my observer. I've implemented ...
0
votes
0
answers
38
views
Counting many to one relationship in Core Data
I tried to create simple application, yet I encountered problem with relationship using Core Data in SwiftUI.
I have 2 simple models, ParentEntity:
...
0
votes
0
answers
76
views
React Native (expo) mobile application publishing to stores in Azure DevOps pipeline using different backends for different app versions
Mobile development is quite new for me, and I would like to ask about a solution review. I'm not sure the way I publish the application is correct, I think good companies may do it differently.
I have ...
4
votes
1
answer
664
views
Caesar Cipher in Swift (iOS-app)
I have implemented the Caesar Cipher in Swift and incorporated it into an iOS-app.
I guess it's formally correct. Please see the attached images, which show how the usage of the app is meant.
Here's ...
1
vote
1
answer
62
views
Javascript CLI to boot iOS simulators, install project, extract data, and merge into JSON
I'm a DIY "dev" - so I really create things that I need or think they'll end up helping others.
I wrote this Swift Package so the iOS community could get device bezel radius' to help with UI ...
1
vote
0
answers
32
views
Good way to coding on React-Native?
I'm new on this field of coding, and I start to create by myself a project for iOS and Android. I'm a bit lost of how I supposed to organize my code, I saw different persons on YouTube doing their ...
2
votes
2
answers
97
views
Building a UITableView with fixed number of cells progammatically
I am building this pet project with UIKit. The App's main goal is to keep track of my daily expenses.
The AddExpenseViewController is responsible for capturing user ...
2
votes
0
answers
65
views
Refactoring of this massive ViewController with a UITableView in it
I'm making an application that has a UIViewController with a UITableView in order to show the favorite users that the user of ...
0
votes
0
answers
43
views
Manage Access Control on Swift UI Elements
I have following ViewController class with a tableView.
...
1
vote
1
answer
149
views
MVVM pattern in Swift
I've been coding for some time now and since I am working alone I'm not strict in my coding structure approach(bad idea) and was only focused on getting things done which resulted in MVC(MASSIVE-View-...
1
vote
0
answers
509
views
CoreBluetooth delegate to async stream
I want to use async/await by AsyncStream for Bluetooth scanning. The CoreBluetooth is using the delegate pattern. The following code provides an adapter for using ...
5
votes
3
answers
232
views
Sum of natural numbers below threshold
I have this code:
...
2
votes
0
answers
67
views
Function for formatting data retrieved from a battery via Bluetooth Low Energy
I have the following function in Swift and am looking to improve the readability. The function takes from the deviceData object which holds maps of data like ...
1
vote
1
answer
221
views
API call to list top stories using dependency injection in iOS with MVVM
I'm currently trying to find out what's the best networking architecture for MVVM applications. I couldn't find many resources and decided to go with dependency injection based architecture as per the ...
1
vote
0
answers
86
views
Setting constraints to scale app's UI for consistent display across all iOS devices
For apps which don't have significant layout changes between the iPhone and iPad versions, I usually set the constraints of all UI elements (views, labels etc.) as fractions of the current device ...
3
votes
1
answer
802
views
UIImage downscale and compression
getFinalImageData(:UIImage) takes a UIImage and downscales its size dimensions (to 400 ...
0
votes
1
answer
56
views
Understanding How To Approach A Permutational Word Search
This question is carried over from StackOverflow... First time posting here, so bear with me.
The topic is constructing a search made up of a given string, and a series of letters, where each of the ...
1
vote
1
answer
626
views
Best way to do Input Validation on Swift/iOS/UIKit
I have the following form that creates a new "activity":
For which I want to enforce the following requirements:
Name => minimum # of chars: 1; maximum # of chars: 50
Description => ...
2
votes
2
answers
229
views
Replace Western Arabic numerals with Persian digits
I've written and used this code in my apps whenever needed to convert any Western Arabic numerals into Eastern Arabic (or better say, Persian/Farsi) numerals in any Persian text.
It works fine as ...
1
vote
1
answer
3k
views
Changing the color of some pixels in an image in Swift
My code is working perfectly fine, except for one-thing. The performance is not up-to the mark. What I am trying to achieve is I have an image with a few circles (each circle has a border with ...
4
votes
2
answers
150
views
Fetching data closure completion
I started learning MVVM and API data fetching, so I made this code:
Function loadDirector in which directorName value is ...
2
votes
2
answers
269
views
Initialize Swift class or struct values inline
For a Metal application, I would like to create and initalize texture object globally so it will not have to be optional, and will already be ready to use once ...
3
votes
1
answer
139
views
Structure and readability of the code in swift ios
For a job in company I had to do a code assignment. My assignment performs all the required tasks needed to be done. But after one month the company provided me a feedback and said that we have ...
3
votes
2
answers
142
views
Determine final player in a counting game
I made a function in which 17 players are counting to number N. Function as a parameter takes a number N and returns which player is going to say N. If current number is divisible by 9 the counting ...
2
votes
1
answer
161
views
Swift code to extract most common page sequences from an Apache server log
So I received the following prompt for a code interview:
"Please create an iOS app that downloads a text file from our server, parses the
contents, and displays the results. The file is a ...
0
votes
2
answers
178
views
How to load and get data from 2 files
I want to load 2 files and show this data in 2 strings. I trying to do it like this and it works fine. But I think it is not the best solution... How to do more elegant solution?
...
4
votes
2
answers
1k
views
Better way to provide data to UIKit component from Combine pipeline
Today I'm researching how to provide data to UIKit component when using Combine pipeline.
I could see tons of tutorials about how to use SwiftUI + Combine from internet, but not found anyone helpful ...
4
votes
1
answer
305
views
JSON parsing service
I created the following service for the purpose of sending in a file for parsing. I'm using the generics so that when I call parse() I can pass a custom type ...
3
votes
1
answer
150
views
Swift iOS rewrite a function that use Firebase database without updating a global variable
I'm learning swift programming and i built a music trivia app for iOS that use firebase real time database.
I have a function that before the game start get the number of record for each category of ...
2
votes
1
answer
85
views
Which is better-way to casting model
I need to convert my model to fit data in tableview cell finding better approach
...
2
votes
2
answers
176
views
What can I learn from this coding test?
So I was recently asked to complete the following challenge for an interview:
Programming Problem
Provide a production ready solution that accepts a new user name, validates a single string input as ...
2
votes
1
answer
224
views
UIView position updates based on device motion via RxSwift
I've created a simple function to work as a level, where the dot on screen is centered when the device is completely flat. It changes position based on device orientation. I use RxSwift to update the ...
5
votes
1
answer
331
views
Sorting JSON items from a site
So I recently applied to this job for iOS Developer and was invited to complete the following code challenge:
As a next step, please complete this coding exercise in order to proceed with our ...
1
vote
1
answer
502
views
Improving sqlite3 code in swift using c api
Trying to come up with a pattern where the code to open db, writing queries is elegant and clean while handling all possible error conditions.
Following code
...
3
votes
1
answer
103
views
Break music player into usable components in SwiftUI
I created a music player using swiftUI.I need to ask a question when I break up my player into usable components. How should I take this approach with the music player? because the music player is one ...
2
votes
0
answers
26
views
Is this way of handling events in a Xamarin project memory safe?
I inherited a Xamarin project and I'm trying to find my way. The first task I completed involved creating a new reusable view and adding it to an existing screen. This was iOS specific, so I went and ...
3
votes
1
answer
2k
views
SwiftUI Dot indicator
I want to understand if I got this concept correctly.
I should start work from ViewState; a reference type object holding the state of a view. Here it is called <...
4
votes
1
answer
113
views
POC for GithubUserFinder
I would like to request iOS developer community to please review my POC i.e. [GithubUserFinder][1] which I have created as part of job screening test at T-mobile Bengaluru.
I have around 2 years of ...
3
votes
0
answers
287
views
Combine asynchronous return values in SwiftUI
I have 2 asynchronous return values from 2 different classes, one from HealthKit, the other from MotionManager. I combine the outcome of these classes through a combinedViewModel. The code works, but ...
2
votes
2
answers
597
views
Convert C to Swift
I trying to convert this C code for calculating distance from RSSI to Swift code. I try to do it by myself, but considering I'm beginner, I need help in how to do it.
Here is C code:
...
1
vote
1
answer
171
views
Service Locator with Lazy Loading in Swift
I am experimenting with the ServiceLocator pattern. I'd like to support lazy loading of items.
...
1
vote
0
answers
615
views
iOS Core animation cancel and restart [closed]
There is a simple movement CAKeyframeAnimation, what needs is that I can cancel and restart the animation freely.
The key point of the following code, is that I ...
1
vote
3
answers
3k
views
Create UIView programmatically in Swift
I am generating View and setting constraints programmatically in UIViewController
...
2
votes
3
answers
185
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.
...
2
votes
0
answers
721
views
Java's AtomicInteger equivalent in c#
I'm trying to replicate Android's GenerateViewId() to assign a unique Tag to dynamically created UIViews in Xamarin.iOS.
...
1
vote
1
answer
95
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
81
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 ...
6
votes
2
answers
2k
views
100DaysofSwiftUI - Project 1 - Challenge 1: Convert temperature units: Celsius, Fahrenheit and Kelvin
This is my code to solve the challenge in 100 Days of SwiftUI by Paul Hudson. This is the first challenge in the series and I chose to convert the temperature units from C° -> F°, F° -> C°, C° -> K° ...
2
votes
2
answers
191
views
Searching within a data model using an array matching multiple terms
I have a standard tableview app that displays information from a data model array that uses a custom class. There is a UISearchController to filter the data.
A ...
1
vote
0
answers
35
views
Manage Recent List Of user and staff type objects
So I have a view which shows recent 5 staff users and 5 customers for a restaurant app. I am storing this in user default.
I am also managing the currently selected object.
Here is my class.
...