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

1
vote
0answers
4 views

Simple plotting abstract base class and example subclass

I came across a CocoaControl ZFPlot and wanted to extend here. I ended up writing a base class (ZFPlot shown below) as well as several extensions (ZFLine, ZFScatter, ZFBar, none shown here for ...
-1
votes
0answers
17 views

Error with Piano App [closed]

I'm basically making a piano app that plays individual notes for corresponding buttons. I've looked all over and have come up with the following code, but it is flawed. The notes are listed as C, Cs ...
3
votes
1answer
25 views

Downloading and parsing data

I developed this class to download a JSON from a server, parse the result and call a delegate back on the class that called it. Since I am self started I want to know if this is a good practise. ...
3
votes
0answers
31 views

Algorithm for downloading images

I am working on a product application where user could sell/buy. This application is based on collection view. Collection view has collection cell where it displays product image thumbnail. The ...
2
votes
0answers
30 views

Quartz2D, circular slider performance optimization

I have a circular slider. Each time i move finger i call [self setNeedDisplay], get new angle to change handle position and mask arc. When i move very fast my CPU load about 70%, it's very hight as ...
0
votes
0answers
60 views

Performing a fast Fourier transform on an audio file

I am using the accelerate framework in Swift to perform FFT on an audio file; however, I'm not sure if this is working properly and I don't know how to find the fundamental frequencies from here. ...
5
votes
1answer
65 views

Optimise Code for KukuKube Game

I developed a Kuku Kube game for iOS. Each time I choose a correct different color tile, it will increase a number of tile quantity 2x2 3x3...10x10. How to optimise the code each time the tile ...
5
votes
0answers
46 views

Moves box in direction of touch, and has wraparound when reaching edge of screen

Part of me thinks that it would be simpler to ditch Apple's move API and just updated position with a timer. I know that's what I did with a JS canvas snake game I built a while ago. But I'm also ...
6
votes
2answers
250 views

Background execution in iOS

The following class BackgroundExecutable is to be used to take a function f and return a function ...
1
vote
1answer
61 views

Retrieving creation date from Parse.com data

I got to show the createdAt date in a message timeline, I tried to make a separate array only for dates, but don't know if it is the right path to follow. It seems ...
3
votes
1answer
101 views

Set a font for a UITextView if the font is nil or not equal to desired font

Main question I am setting a font for a UITextView that is a subview in a custom view. I only set it if the user didn't specify the font size in the Interface Builder. I have the following working ...
3
votes
1answer
67 views

Switch statement for adding/removing operands to the text part of a label

I have a switch statement with five cases, and four of them are really similar to the others. How could I properly refactor this code to eliminate the duplication of code? ...
4
votes
2answers
352 views

Removing a subview with a subview from a UIView without memory leaks

I made a custom UITextView for vertical Mongolian writing. It is made by subclassing UIView, which has a subview called ...
5
votes
1answer
73 views

Repeatedly check URL for change on iOS

I am wanting to constantly check a URL http://www.example.co.uk/untitled.php which will either return 1 or ...
-1
votes
1answer
86 views

Reading QR Code

What I need to accomplish is matching the QR code to the one I have created. This code works, except it takes at least 30 seconds to verify that it has matched my QR Code. How can I make it faster? ...
4
votes
2answers
264 views

Recursive function to show directions for multiple locations

I have a Mapview which shows a bunch of locations (Events). Here's the code of an Event object. ...
4
votes
1answer
126 views

Using Grand Central Dispatch to fetch data from Parse.com and update UI asynchronously

This works, and the UI is snappy in the simulator, but since this is my first time really using GCD, I'd just like this code to be reviewed before I start using it everywhere. Note that this is ...
3
votes
1answer
59 views

Constraints for auto layout

I am adding some constraints for my auto layout. My method calling the methods creating the constraints: ...
1
vote
0answers
85 views

Interactive transition between view controllers

I have made an interactive transition controller in Swift in two different ways. This interactive transition controller is the parent class and I have few child classes which adapt the parent for ...
0
votes
2answers
62 views

Image-uploading

This currently works properly, but just takes too long. Some of the functions in it are necessary and need to remain, such as resizing, and double saves. But it probably has room for improvement. I ...
10
votes
1answer
93 views

Blurring an Image

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
8
votes
2answers
184 views

iOS Utility methods for UIView

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
3
votes
1answer
93 views

Second attempt at Hangman in Swift

I recently posted my Hangman game, and got some amazing feedback! The main thing suggested was to create a word generator that could read JSON files so that my hangman brain class didn't have to ...
7
votes
1answer
80 views

Hangman in Swift

I am a Java programmer trying to learn the ways of Swift. I coded a Hangman game in Xcode. I was wondering what I could improve, specifically whether I used delegation correctly and if there is ...
3
votes
0answers
57 views

Second attempt at Sierpinski Triangle App

I am a Java programmer trying to learn the ways of Swift. A few days ago, I posted the code for a very simple app that draws a Sierpinski triangle and implements a pretty buggy zoom. I was told to ...
8
votes
1answer
175 views

Parse query checks and increments

In my app, the user can upvote a cycling track if they want to ride on it. Note: I do understand I can use a boolean column to check if a user has voted or not, but, I am just testing at the ...
7
votes
1answer
53 views

Draw editable angles

One of the first things I did when I learned Objective-C was to create a little canvas with editable angles. Basically, you tap to create points. Every tap connects to the previous tap. So if you tap ...
6
votes
1answer
165 views

Multiple Choice Guessing Game

I've built an app for members of an organization I'm in--the app shows the picture of a member with four multiple choice buttons, and the user then tries to guess the member's name. Pretty simple, ...
10
votes
1answer
94 views

Finger painting code

I have a very simple view that handles touch events and draws accordingly. It's nothing significant, but it does use a bit more CPU than I would like (35%). Again, it is the bare minimum (<90 ...
4
votes
1answer
68 views

Imitate UITableView reordering interaction

I have a UIScrollView full of vertically stacked subviews which I want the user to rearrange as they desire. I've implemented a ...
-1
votes
1answer
55 views

Globally accessible helper class [closed]

I would like to get opinion if I am doing this right. I am creating a helper class that is globally accessible to my whole project. I want it to be easily called like ...
3
votes
1answer
50 views

Managing a wish list from an API

I have a class that I use to manage a list to/from an API in Swift. Using a clean code approach, I'm wondering if, how, and why I should change it when I have a class that uses it for just one or two ...
11
votes
1answer
95 views

Top wiki pages as an app

I recently did an interview task. I was rejected because of bad code quality. There was two tasks. Here I will present the first, second will be posted in time. This project is avalible on GitHub ...
3
votes
1answer
176 views

Show a quiz from JSON in iOS

I have to create a quiz of showing questions from a JSON and post back the answers. Here's the structure of JSON: ...
8
votes
1answer
868 views

First assignment for Stanford iOS8 Course: enhancing a calculator

I recently started learning Swift through Stanford iOS8 Course. The first assignment is to add some features to simple Calculator which was presented during lectures. List of tasks: add button for ...
6
votes
1answer
184 views

Checking two text field for match and checking for null

Is this the most efficient way to do this? Any suggestions on some thing I might have missed or can do better? ...
7
votes
1answer
71 views

Comparing 2 arrays of dictionaries and saving user preferences

I will start by explaining the situation and then show some code. I have an app that has an array of "default" settings to display on a user's dashboard. The user can modify these settings to enable ...
2
votes
1answer
80 views

Determining the number of days from today

Today I've got a pretty simple snippet to be reviewed. The function is extremely simple, as all it does is retrieve some entities from Core Data and then compares the ...
2
votes
1answer
105 views

Idiomatic way of handling optional values in Swift

I'm new to iOS development and also Swift. I'm working on a project consisting of a menu that leads to my various experimentations with the iOS SDK. I've written the menu titles and ...
5
votes
2answers
468 views

Registering a plist to NSUserDefaults

I've been struggling with registering a plist into NSUserDefaults and I've finally got it working, though I'm not sure that its written properly. I'm hoping someone ...
7
votes
2answers
251 views

Simple 3…2…1 countdown in iOS app

I would like to display a 3...2...1 countdown on my iOS app (before to take a picture) but I didn't find an elegant solution. I don't want to make a Countdown app with an NSTimer. For me the important ...
11
votes
3answers
5k views

Swift iOS - Call back functions

I'm working on an iOS app which handles API request based on authentication. Authentication is done through OAuth and every API request is sent along with ...
3
votes
1answer
125 views
1
vote
1answer
103 views

Push Notifications - save token id into a database using Asynchronous Request

based on this answer I modified my code. Is this the correct approach now? ...
4
votes
1answer
1k views

Save token id into a database in Swift

I want to save my users tokens id into my database using POST request in Swift (here PHP code here). I am a bit confused about synchronous and asynchronous request. Is this code the right way to do ...
2
votes
1answer
260 views

BaseTableViewController with pull to refresh and auto load more

I've implemented a table view controller for the purposes of subclassing. The table view controller implements a pull-to-refresh which will automatically reload the table view's data. I am looking ...
5
votes
1answer
256 views

Avoiding callback chaining in authenticator

I'm developing an iOS Application in Swift that uses Google Cloud Endpoints as its backend. For now, I've just written the code for the user to login with his Gmail account and I've refactored it as ...
0
votes
0answers
163 views

Unit testing - Parsing data from the Weather Underground API

I'm writing unit tests for the first time. The tests are for my library on Github. I downloaded the JSON and stored it into a local file that looks like this: ...
2
votes
2answers
446 views

Creating an iOS form with many similar text field cells

I'm using multiple instances of an object creating a form: ...
6
votes
2answers
623 views

Clear function for Stanford iOS 8 Calculator application

I am following the Stanford iOS 8 lectures and I believe I have successfully added the "Clear" functionality to the application, but I don't know if I am doing it properly. Controller ...