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.
1
vote
1answer
29 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
16 views
Touches ended function not executing [on hold]
There seems to be a problem with my touches ended function. My touches began function works perfectly fine, although when i release my touch nothing happens.
Here is my touches began function which ...
0
votes
0answers
10 views
Touches ended not executing [on hold]
Anyone know why my touches ended code is not executing. My touches began function is working fine, although when i release my finger from the touch nothing happens any help?
`override func ...
0
votes
0answers
69 views
2
votes
0answers
39 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
108 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
19 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
55 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
29 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
63 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 ...
3
votes
1answer
74 views
0
votes
1answer
34 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
76 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
54 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
46 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
116 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
59 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
124 views
NSFetchedResultsController Container
This is a wrapper for multiple NSFetchedResultsControllers. Essentially, a drop in replacement for NSFetchedResultsController to ...
2
votes
1answer
127 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
743 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
26 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
103 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
60 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
128 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
36 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
60 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
93 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
192 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
357 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
838 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
119 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
56 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
115 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
228 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
102 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
66 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
99 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
76 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 ...
6
votes
1answer
200 views
iOS delegation design pattern
I am working on a project that has a Model-View-Presenter structure and use the delegation design pattern that has the following structure/implementation. I would love feedback.
The ViewController ...
2
votes
2answers
681 views
Music player in Swift
I made a simple mp3 player that plays, pauses and stops a given song, shows the time elapsed, and has a volume control. I read the documentation and can't figure out the difference between the ...
3
votes
1answer
166 views
Using an Edit box in a table views header section to insert the values into the table using swift
Allow me to provide some context. I have a UITableViewCell that contains an EditText and a Button. This cell is then inserted into the self.tableView.tableHeaderView...
4
votes
3answers
128 views
Amanda's Relationship Tips app, with scroll performance issues
I am having some major issues with scrolling in my active app "Amanda's Relationship Tips"
Under the User Advice tab:
I'm using the Parse Database as a backend to pull user data. This lag is ...
4
votes
1answer
90 views
Swift menu code
I want to know what do you think about the structure of this code. If you think that there is some structural improvement to be made, tell me!
Here is a github link: https://github.com/LucianoPolit/...
3
votes
1answer
147 views
NSUser defaults cellForRowAtIndexPath
I have been going back and forth on one certain part of my code. It works, but it doesn't seem right for some reason, as I believe there must be an easier/cleaner way to implement the ...
1
vote
1answer
81 views
Using nested if statements to select textfield for update of associated label
So I have written a very simple program using a cocoa pods library to calculate the distance between different cities. Here is what the UI looks like:
So I have a textfield on top for entry of ...
2
votes
1answer
355 views
Image Scrolling in UITableView with Parse
I'm trying to create an app that is scalable. One of the main features of the app is to view images from a database to a UITableView. Here is my code:
...
4
votes
1answer
1k views
Caching image in memory or on disk
I am caching an image locally..That same image will be used in few screens. Steps for doing this is as follows:
Get image from cache
If not present in NSCache, get image from Cache directory
If not ...
6
votes
3answers
243 views
Loading Configurations from plist into singleton
In my iOS application, I've created a singleton class that reads a configuration plist file and provides accessor methods to easily retrieve the values:
...