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

Applying Gaussian blur to UILabel

Here is the code and it is really slow, like seconds slow to render about 25 labels. ...
3
votes
2answers
272 views

A C++ wrapper for Apple CoreFoundation

The wrapper makes it easy to manage memory when using CoreFoundation objects. It aims to act like a simple shared_ptr. Here is a usage example: ...
-1
votes
2answers
107 views

Up/down arrow key commands

There are sources with these rules. I've listed the source too much, but I want to make it shorter and easier. ...
1
vote
0answers
187 views

Singleton lock for a queue

This is a singleton class which can be accessed anywhere including the shouldLock variable. I want to make sure that the variable is thread safe. Basically the <...
4
votes
1answer
687 views

Drawing a word, with a box around one letter

I'm working on a draw function which needs to draw the word 'crux' in the center of the current view and then draw a red box around the 'x' character like this: My ...
2
votes
1answer
219 views

Handling several types of messages over a web socket connection

I have a UIViewController with a Socket Connection established once viewDidLoad. This web socket is a multi-directional ...
2
votes
1answer
2k views

Filtering input characters for a numeric text field using logical operators

I did my code for "Bronze Challenge: Disallow Alphabetic characters" exercise in "iOS programming" book by Big Nerd Ranch (p.85). When I did the exercise I also changed code of func textField which ...
4
votes
0answers
459 views

Update UI once all API calls are done

I'm learning Swift at the moment but I would like to produce well-organised code. The goal of my little app is to display the weather of my current location. I use : the API of Darksky : https://...
3
votes
2answers
2k views

Comparing strings, ignoring case, punctuation, and whitespace

I have built a search function that will compare strings regardless of punctuation and whitespace. It is case insensitive. Here is my current function: ...
2
votes
0answers
154 views

Comments on singleton Swift status bar alert

I was trying out some projects like a status bar alert. It made most sense for this status bar to be a singleton: there is only one alert visible at a time. ...
2
votes
1answer
75 views

Algorithm optimisation to get first parent with specific kind of class

I am writing an extension for UIViewController to search all the parents and return a specific parent which is a kind of specific class. here is my try : ...
1
vote
0answers
281 views

Handler for a UI to select multiple days of the week for notifications

In the app I am currently working on, there is a part where user can set multiple local notifications for specific weekdays. The array of buttons is represented by a separate class, which utilises ...
2
votes
1answer
147 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: ...
1
vote
2answers
127 views

Switching between queues in cellForIndexPath method

My tableView is scrolling very slowly because there is a fetch request done in every cellForIndexPath method. I have verified ...
2
votes
0answers
60 views

Choosing structure of fields validation module in Swift

I've implemented abstract module for fields validation according to this MVP clean architecture repo. In a nutshell I've created ValidationGateway protocol ...
3
votes
1answer
145 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 ...
3
votes
2answers
77 views

Uploading photos of various sizes

In my solution I've implemented transaction-like methods of uploading posts media. For example I'm adding new post with photo. I want to have 700x700, 200x200, 70x70, 10x10 px sizes in my storage and ...
2
votes
1answer
1k views

Populate TableView with JSON data

I basically want to display JSON data in a TableView. The TableView always displays a List ...
1
vote
0answers
352 views

VIPER Architecture

I write Swift and architect apps mostly based on VIPER pattern. The thing I always wonder is, is it a proper to store some temporal values in Interactor? Let me ...
4
votes
1answer
8k views

Creating a array of custom objects from JSON, sent using PHP from a MySQL database

I'm using PHP to send data in JSON to create an array of custom objects in Swift. I've been told retrieveData() is bad code because it's in an infinite loop. I'm ...
6
votes
0answers
2k views

Iterate through all the photo library in iOS

This function is supposed to return a map of all unique local identifiers of images that are on the iPhone using the IOS Photos Framework. (it is a map so nSnull or (any object can be mapped to it) ...
1
vote
0answers
756 views

RxSwift iOS Observable FIFO Queue Implementation in Swift 2

I am trying to develop an Observable queue that executes given Observable chains one at a time. The code will be used to encode videos on an iPhone and only one queue will be needed per launch, ...
1
vote
0answers
154 views

Multi-Context CoreData Implementation

I'm using Mulit-Context CoreData for Asynchronous Saving, which follows this architecture: Here is code stack: ...
2
votes
0answers
97 views

Private contexts and their parents in CoreData

I find myself following this pattern a lot in my core data code, which works, but I'm wondering if it is needed... ...
1
vote
1answer
813 views

Styling navigationController per viewController

The design of my application consists of multiple viewControllers which all have different styling applied to them. The following code is used in every viewController to style the viewController: <...
9
votes
0answers
896 views

Interview coding challenge for iOS Part 2 - the application in Objective-C and Swift

I recently interviewed with a company that needed a C/C++ programmer to work on the iOS side of the products. The job description indicated they needed someone with 4 years of Objective-C and iOS ...
4
votes
1answer
731 views

Interview Coding Challeng for iOS Part 1 - the Static Objective-C Library

I recently interviewed with a company that needed a C/C++ programmer to work on the iOS side of the products. The job description indicated they needed someone with 4 years of Objective-C and iOS ...
1
vote
1answer
1k views

Draw grid programatically with borders

I need to draw a grid with some special requirements. My current solution is working but is far away from ideal I guess. Attached you can find the current working solution: Some of my thoughts which ...
1
vote
1answer
925 views

UIViewController without interfacebuilder

I have a template I've been using with Swift for UIViewController and UIView subclasses without a ...
4
votes
1answer
175 views

Convert String to Integer (calculator app)

I'm currently learning Swift and today I created my first application, a simple calculator. My main goal was to practice and create something without any help. After a few hours my application was ...
4
votes
1answer
5k views

Countdown timer in every table cell

I am making countdown app with multiple records, so I am using UITableView to show that records and countdown dates. What I do is just take one timer and reload cells on every second. Is this a best ...
4
votes
1answer
67 views

iOS game of drawing sticks with AI and scoring

My code actually works. I was just wondering if there was alternative ways, maybe even more efficient ways of coding my program. This is suppose to be a game of drawing stick, and it's recording the ...
4
votes
1answer
2k views

Finding consecutive days in an array of dates

The problem: How to get the largest number of consecutive days from an array of unknown number of Date objects, by taking into account days only like 4th of April, 5th of April and so on. Example ...
1
vote
1answer
35 views

Making a TableViewDataSource more independent of the data it utilizes

I have written an ordinary tableView to display a list of players, with the following data structure that's in place. A Conductor (which is the user), has many <...
2
votes
1answer
135 views

REST API client

I am new in iOS development and Swift. I am going to develop a simple application which communicates with external REST services. This is my first experiment. I appreciate feedback on best ...
2
votes
0answers
154 views

Throttling several HTTP parallell requests

I'm using the above piece of code to do some HTTP calls in parallel. This loop is running inside a NSOperation. I must throttle a bit the requests (so I don't overload the server). The code is working ...
2
votes
1answer
894 views

Implementing delegate methods in an UIView class

This is my UIView class: ...
5
votes
1answer
3k views

Swift 3 UIPicker

I have been making a little test app to try and learn Swift 3 / iOS better. I started a while ago with with Swift 2 but stopped, so getting back into it, but there is so much iOS to learn! It seems ...
1
vote
0answers
48 views

Create a new event and view its details

I have A page, where you can create an event using the name, location, enddate startend date, attendee, URL location, repeat options, alert options and etc. There is two scenario when the user can ...
2
votes
1answer
131 views

CommandLine StreamFormatTester

Using Chris Adamson's book Learning Core Audio I'm getting familiar with Core Audio for Mac/iOS. The code examples are 100% Objective-C. I'm trying to follow along using Swift 3. This small piece of ...
1
vote
2answers
2k views

Checking that a 6-digit number is not repeated and not in sequence

Following is the objective C code snippet to check that the 6-digit number is not repeated and not in sequence/reverse-sequence. I have just printed the proper messages in ...
1
vote
1answer
2k views

Showing segue after button action

I have an iOS Swift app with 8 buttons that call the same segue, but this is very repetitive. How can I refactor so it uses the same function prepare? ...
6
votes
0answers
380 views

Swift class to check ApplePencil reachability

I've implemented a class that lets you check out whether there is an ApplePencil connected to the device or not. ...
3
votes
0answers
400 views

Posting iOS notifications from sender or from receiver

In Swift, should I be posting notifications to the iOS notification center from the device sending a text message or from the device receiving it? I'm using ...
3
votes
1answer
3k views

iOS Core Data Model with Swifty JSON

I have been using SwiftyJSON to create my models of Object in Swift. But recently, I moved to CoreData for saving the objects locally. I am new to CoreData and want to know the best practices I should ...
3
votes
1answer
354 views

Singleton class with custom initializer

In a Swift project, I have a class should be used as a singleton: ...
2
votes
1answer
14k views

Setting constraints for dynamic views in iOS

I have an app which uses Stack Views to update its UI depending on the number of pigs. For example below, 1 pig and 4 pigs. I set up Stack Views in Storyboard and set isHidden to true based on how ...
2
votes
2answers
876 views

Property value from an asynchronous operation

I have an app which has a session mechanism. When a user creates an account in the app initially, the API returns an access token, the expiry date of that access token and a refresh token which can be ...
0
votes
1answer
151 views

Simple HTTP API requests in an exam paper download app

So basically I am building an app that helps to download some documents via a rest api. Here is the SearchViewController ...