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.

learn more… | top users | synonyms

0
votes
1answer
42 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? ...
0
votes
0answers
38 views

Filtering two attributes using Firebase

I have a game data structure in Firebase that looks like this.. I have a view controller in my app that loads up all the games for a specific team. I have the following code which works. ...
5
votes
0answers
75 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. ...
2
votes
0answers
32 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 ...
0
votes
1answer
114 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
81 views

Singleton class with custom initializer

In a Swift project, I have a class should be used as a singleton: ...
1
vote
1answer
45 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
70 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
40 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 ...
1
vote
1answer
56 views

Controlling Drone with iOS Speech Recognition

I got a Parrot Mambo which comes with an SDK for creating your own app for controlling it. I decided to use the iOS Speech Recognition library so I could use basic voice commands to control it. The ...
3
votes
1answer
50 views

Simple War game in Swift

I'm new to swift and I want to know if I'm doing something wrong or a harder way. I made a simple war game app. Tames of variables aren't correct, I know, but I was doing it quickly and I didn't worry ...
1
vote
2answers
110 views

Showing activity indicator (loading image) while processing in background

I have a login screen on my iOS app. When I click login button I want to make sure that user should be displayed a loading image in center of the screen. I found lots of different methods online but ...
1
vote
1answer
65 views

Configure Table cell in model class

I'm trying to show data in UITablleView after getting it from an HTTP request. I heard that the best and professional way to do it is configure the cell and do the ...
0
votes
0answers
88 views
2
votes
0answers
105 views

Generic wrapper for Alamofire Request's function jsonResponse wrapper

I am trying to wrap a responseJSON function of a Request class of Alamofire because when I send an API request I get a response ...
3
votes
0answers
115 views

Adding swipe support to multiple classes

I have implemented swipe functionality using UIPanGestureRecognizer in a project. What I have done is added PanGesture to ...
1
vote
0answers
27 views

Block breaking with paddle/ball iOS Game

I created an iOS app that recreates the "ball breaking" game where a paddle is used to deflect the ball to break blocks. The main purpose is to get familiar with UI concepts since I have primarily ...
2
votes
1answer
67 views

Categorized Photo Albums

I was told the function "hompage" was too clunky to conveniently make a tableview. The cells will have the information in "PHOTO ALBUM ICONS" and "BUTTON ON TOP OF PHOTO ALBUM ICONS". ...
1
vote
1answer
31 views

Settings the height of rows for multiple screens within a TableViewController

Is there a better way to write this? This is a class that displays a preferences menu. We do this when the user first installs the app during a walk-through where we only show them some of the ...
2
votes
0answers
118 views

Implementation of a like button in iOS for Instagram like app in Swift

I have just completed an implementation a like button for an Instagram-like app, but now that I am looking at it I feel that there is something off. Maybe it is my formatting or maybe I am not quite ...
4
votes
1answer
107 views

Check for iOS version

Here's an approach i came up with for checking IOS versions. ...
0
votes
1answer
41 views

Hard-coded iOS keyboard [closed]

I am starting to write code for a keyboard in iOS. It's pretty much hard-coded and I need suggestions on how I can make it more professional style and more efficient. ...
1
vote
1answer
94 views

Using a webservice with blocks and returning data via callback

I load some data from from my webservice via a method using blocks and callbacks. From my ViewController I make a request to the data loading class and pass the ...
3
votes
1answer
58 views

Creating an area graph in iOS

I am trying to create an area graph from the upper and lower limit values. First I created two line graph from those points as: Sample data points are: ...
0
votes
1answer
84 views

Calling a method only once in an updateScore function in SpriteKit

This works fine, but obviously it's messy and I'm thinking there has to be a better way to do this. Having to constantly remember to flip the bool back is a pain, is there anything else I can do here? ...
1
vote
0answers
186 views

A custom UIView with gradient fill, border, and variable corner radii

Here is a swift port of UIView subclass that I use often in my apps. It allows me to easily set gradients in place of the backgroundColor property, and also makes it very easy to create views that ...
1
vote
0answers
93 views

Spawning nodes with random time interval in SpriteKit

I want to spawn objects with random time interval (from 1 to 3 seconds). I've wrote this function: ...
2
votes
0answers
47 views

Adding or editing a child

I have a class which will add or edit a child. So whenever I click on "save," I need to check the child image. If it's an image, then I need to upload to the image server. Once that's done only, I ...
0
votes
0answers
134 views

NSFetchedResultsController Container

This is a wrapper for multiple NSFetchedResultsControllers. Essentially, a drop in replacement for NSFetchedResultsController to ...
2
votes
1answer
234 views

Core location background update and upload to server

I want to upload a user's location to a server to send them a location-sensitive alert, so the location needs to be fairly accurate: ...
1
vote
0answers
934 views

Expandable tableView cells

What I wanted to achieve is tableView with clickable cells, anytime somebody click a certain cell, another cell with picker, UITextField etc appears below, it's like a dropdown menu. When browsing ...
1
vote
1answer
28 views

Export class instances to a string (for sharing, backup) and importing them

I have a class (Patient) with many instances.. I need a way to share the instances with other users, so I thought of converting the instance into a string and sharing it, then reconverting it into an ...
3
votes
0answers
107 views

Sesame Street project

I started a tutorial online to get a little bit more knowledge about views. But after I did the basic I decided to finish the game. The game is a little "I spy" game where the user tries to guess the ...
2
votes
2answers
64 views

UIFont expansion

I wanted to expand the UIFont class in my application so I could use the large/medium/small letters concept. I created but for some reason it looks weird. I ...
2
votes
1answer
167 views

NSURLSession load images on demand

I'm trying to come up with a system to populate my item images on demand, this is what I have so far. One obvious bug is that an item image could be downloaded multiple time since the ...
1
vote
0answers
37 views

Abstraction of NSNotification that removes the existing observer for a notification when a new observer is added

I ran into a problem in my app where under some conditions, a view controller might be loaded more than once before its deinit (where I was previously removing the observer) is ever called. So the ...
3
votes
1answer
63 views

Model for math facts

I've written a model for an app that generates math facts kids have to solve by evaluating the operation and the difficulty you pass to it at initialization. I don't like how I am repeating the code ...
2
votes
1answer
129 views

Show and hide views

I have some buttons in my class that show or hide two views (by setting their alpha property to either 0 or 1) when the user taps on them. I have written a function that uses the ...
1
vote
0answers
253 views

Showing Or Hiding AdMob Banners - Purchased vs Not-Purchased IAP Banner Non-Consumable

I have the following code that displays a standard AdMob banner depending on whether the user has purchased an ad-free (banner-free) non-consumable In-App Purchase or not (i.e. If purchased, no ...
2
votes
1answer
463 views

iOS MQTT client app base view controller

I've been working on an iOS IOT client app which uses MQTT. After some reading I decided to go with CocoaMQTT. I have only been programming in swift/iOS for about 2 weeks now, so I thought I should ...
7
votes
1answer
1k views

Creating SwiftReachability Class in Swift 2.2

I am novice at creating independent classes for user. I have seen many Reachability library for Swift, but I need to create my own class for that. Here is my code: ...
5
votes
2answers
69 views

Time manipulation for notification reminders

I'm new to programming, Stack Overflow and Code Review. I was encouraged to post this method here based on a question I posted on StackOverflow here. Let me know if you have tips for improving this ...
2
votes
1answer
135 views

Extending UITableViewCell to preserve UIView background color when selecting the cell

When a UITableViewCell has subviews with background color set, when setSelected(_: animated:) gets called, all the views are ...
0
votes
1answer
61 views

Factory pattern for image or shape marker [closed]

I'm making a photo marker application and need to make a factory pattern for marker. I think it is not very flexible and overall not good. Would you check my code and suggest what could be improved? ...
7
votes
1answer
135 views

Adapting layout for various iPhone and iPad screens using constraints and multipliers

My experience with autolayout tells me that it's very difficult to make app look good on whole variety of devices (from iPhone 4s to 6s especially). Size classes are useful with device position and ...
3
votes
1answer
285 views

Tracking a geolocation

I have created this ViewController using Swift. Its job is to track geolocation and draw a line on a map and save it to core data object. I just want some advice on ...
0
votes
1answer
108 views

Stanford developing calculator iOS app assignment

I'm currently learning Swift by following the Stanford developing iOS app 2015 lecture series. I have completed assignment 1 but am wondering if there is any improvement can be made to my code. Also, ...
0
votes
4answers
67 views

iOS SDK object to represent a place

I am building an iOS SDK to be consumed by apps. I am building an object that represents a physical place. The interface looks like so: ...
1
vote
1answer
124 views

UICollectionView button target

Within my app i have a UIButton (avatar button which shows a profileVC) within a UICollectionView this button shows up in about ...
5
votes
1answer
78 views

Sorting an array of time-specific tasks of varying importance

RULES: Strict tasks must occur at the time the user selected no matter what. Flex tasks are in a priority order. Even if there is a gap big enough to fit several flex tasks with lower priority, no ...