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.

Filter by
Sorted by
Tagged with
1
vote
1answer
144 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
2answers
113 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 ...
3
votes
1answer
82 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 ...
2
votes
1answer
73 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 ...
0
votes
0answers
203 views

iOS: Combine and Clean Architecture

I’m learning a lot of from Combine thanks to an amazing book in raywenderlich. Currently i’m writing an app and following the clean MVVM architecture. Then I have the following layers: Domain(...
2
votes
1answer
123 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
2answers
123 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
2answers
349 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
1answer
181 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
1answer
99 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
1answer
75 views

Which is better-way to casting model

I need to convert my model to fit data in tableview cell finding better approach ...
1
vote
2answers
157 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
1answer
127 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
1answer
288 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
1answer
133 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
1answer
82 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
0answers
22 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
1answer
409 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
1answer
99 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
0answers
164 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
2answers
127 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
1answer
83 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
0answers
306 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
3answers
2k views

Create UIView programmatically in Swift

I am generating View and setting constraints programmatically in UIViewController ...
2
votes
3answers
143 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
0answers
289 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
1answer
82 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
1answer
60 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
2answers
518 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
2answers
143 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
0answers
33 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. ...
0
votes
0answers
394 views

Swift for flattening JSON nested objects

I am receiving JSON from a service API (Airtable) that returns an object with a single key records which is an array of objects. These objects have most of their ...
1
vote
1answer
67 views

iOS: prettify random color for debugging

iOS: prettify random color for debugging I used to use random color to debug, from colors I like ...
2
votes
1answer
200 views

iOS Body-Mass-Index (BMI) app

This is "homework" from a Swift course, which I'm currently taking. A mockup and the image-assets are provided by the instructor. We are supposed to create the layout and to write some appropriate ...
1
vote
1answer
275 views

Convert image to grayscale

To convert JPEG file, C function, bgraToGrayscale is called from Swift. Is there a better way to 1.allocate memory and 2.access pointers than the ways they have been done in code below? And ...
1
vote
1answer
342 views

Unit Test class from iOS

I am learning to write test cases in iOS using Swift. I was stuck at testing static functions from my Utilities class, so I ...
2
votes
2answers
107 views

Handling view state for cardview

I have two buttons 1) Chat button 2) Annotation Button On tap each view comes from bottom and when tap outside view hidden back (Please refer the screen shot) On tap On annotation On tap on ...
3
votes
1answer
266 views

ValueAnimator for IOS - Did I butcher it up?

I am trying to make an IOS tool similar to Android's ValueAnimator... more or less This is useful for situations where you simply want a value to "animate" over time, but rather than necessarily ...
1
vote
0answers
98 views

Clean way of passing parameters in swift

I am creating a user request model to pass-params for web service call toRegisterParams() is used call register web service request toLoginParams() is used call register web service request so my ...
2
votes
0answers
92 views

Convenient way to make an UIImageView ExpressibleByStringLiteral

I want to reduce boiler-plate code and write like this when developing in iOS: let imgView: UIImageView = "share_fareware_text_bg" Here is implementation code: <...
1
vote
0answers
46 views

Combining the text from selected TextFields into 1 TextView - Conditionally [closed]

ViewController2 (source) Has several TextFields, each with their own switches. ViewController1 (destination) Has one TextView waiting for data to be sent to it from ViewController2 (source) But i ...
1
vote
0answers
156 views

iOS Calendar Navigation and Layout

In an effort to explore how the default calendar app works and to experiment with container view controllers, I created the following mock app. See this post for more info about my motivation for this ...
2
votes
1answer
50 views

iOS Attributes in the data model

I am working on a product-related app where the data model for a product attribute feels too heavy. But I can't split it into several small data models because they are all about goods. At present, ...
3
votes
1answer
95 views

UITableView allowing some kinds of requests to be deleted with swipe gestures

I have a tableview which shows a list of objects called Requests. It has 3 segments. Namely Accepted, Received and Sent. And the objects for each segment are in 3 arrays. I want to enable deleting ...
2
votes
1answer
321 views

Cookie Clicker Game

I'm getting into Swift iOS development, and decided to create a Cookie Clicker application as a first attempt. Since I am very new with Swift, I would like feedback and criticism on everything ...
2
votes
0answers
44 views

check condition with userdefaults value exist or not [closed]

I am check first time userDefaults will not save value return 0 else get value from userDefaults I am checking if userDefaults will not save the value, and If it ...
4
votes
0answers
104 views

Swift iOS app for showing motivational quotes, with multiple screens

I'm one month into self-learning Swift, and I would like some advice to improve my coding skills. I have listed 2 situations that I think I need to improve. I'd like some feedback focusing on my use ...
2
votes
1answer
60 views

Playing a sound depending on the currently displayed flash card image

I've developed a fully working flash card app for kids. It has a UIImageView that cycles through 26 cards (abcs) via a gesture click and a music button that will ...
1
vote
1answer
49 views

App sends location data to website

Explaining the idea and first steps Today, I had the idea to do a website which displays my current position. I searched in the App Store for an App and found one named SendLocation. This App ...
4
votes
1answer
89 views

Force-unwrapped property as a contract

I have a class, which is meant to show a full screen modal controller with a set of actions (apart from actions it also has some static content, a lot of labels and images which are irrelevant, so I ...

1
2 3 4 5
8