2022 Developer Survey is open! Take survey.

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 votes
0 answers
16 views

email HTML in Gmail app on iOS 15.4 is rendering wrong [closed]

I have a table in my email and on every device and email providers works well, but on newest iOS gmail app the table is transformed. What could I change to improve this table? My code: ...
user avatar
  • 1
0 votes
1 answer
44 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 ...
user avatar
1 vote
1 answer
84 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 => ...
user avatar
  • 155
2 votes
2 answers
95 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 ...
user avatar
  • 121
1 vote
1 answer
615 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 ...
user avatar
  • 113
4 votes
2 answers
133 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 ...
user avatar
  • 41
3 votes
1 answer
96 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 ...
user avatar
3 votes
2 answers
135 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 ...
user avatar
  • 31
2 votes
1 answer
132 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 ...
user avatar
  • 149
0 votes
2 answers
140 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? ...
user avatar
  • 1
5 votes
2 answers
610 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 ...
user avatar
  • 151
4 votes
1 answer
210 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 ...
user avatar
3 votes
1 answer
132 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 ...
user avatar
2 votes
1 answer
75 views

Which is better-way to casting model

I need to convert my model to fit data in tableview cell finding better approach ...
user avatar
2 votes
2 answers
166 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 ...
user avatar
  • 149
2 votes
1 answer
152 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 ...
user avatar
  • 101
5 votes
1 answer
304 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 ...
user avatar
  • 51
1 vote
1 answer
190 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 ...
user avatar
3 votes
1 answer
92 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 ...
user avatar
2 votes
0 answers
23 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 ...
user avatar
  • 121
3 votes
1 answer
766 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 <...
user avatar
4 votes
1 answer
105 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 ...
user avatar
3 votes
0 answers
215 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 ...
user avatar
2 votes
2 answers
143 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: ...
user avatar
  • 23
1 vote
1 answer
102 views

Service Locator with Lazy Loading in Swift

I am experimenting with the ServiceLocator pattern. I'd like to support lazy loading of items. ...
user avatar
  • 113
1 vote
0 answers
399 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 ...
user avatar
  • 121
1 vote
3 answers
3k views

Create UIView programmatically in Swift

I am generating View and setting constraints programmatically in UIViewController ...
user avatar
  • 156
2 votes
3 answers
166 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. ...
user avatar
  • 156
2 votes
0 answers
391 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. ...
user avatar
1 vote
1 answer
89 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 ...
user avatar
  • 149
3 votes
1 answer
67 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 ...
user avatar
  • 45
6 votes
2 answers
774 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° ...
user avatar
2 votes
2 answers
150 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 ...
user avatar
  • 226
1 vote
0 answers
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. ...
user avatar
0 votes
0 answers
454 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 ...
user avatar
  • 296
1 vote
1 answer
78 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 ...
user avatar
  • 391
2 votes
1 answer
244 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 ...
user avatar
  • 3,758
1 vote
1 answer
308 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 ...
user avatar
  • 111
1 vote
1 answer
463 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 ...
user avatar
2 votes
2 answers
116 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 ...
user avatar
3 votes
1 answer
317 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 ...
user avatar
1 vote
0 answers
100 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 ...
user avatar
2 votes
0 answers
103 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: <...
user avatar
1 vote
0 answers
48 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 ...
user avatar
1 vote
0 answers
170 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 ...
user avatar
  • 267
2 votes
1 answer
51 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, ...
user avatar
  • 133
3 votes
1 answer
124 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 ...
user avatar
  • 331
2 votes
1 answer
361 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 ...
user avatar
  • 9,466
2 votes
0 answers
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 ...
user avatar
  • 121
4 votes
0 answers
118 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 ...
user avatar
  • 61

1
2 3 4 5
8