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.
6
votes
2answers
32 views
Getting WiFi SSID on iOS in Swift
I've seen a lot of Objective-C implementations but I'd like to do it in Swift.
I did it like this and it seems to work just fine. Does anyone have comments and/or improvements to make?
...
4
votes
1answer
21 views
Changing image of a UIImageView based on a scrollView contentOffset
My task is pretty simple and my code works, it's just that my code feels a bit clumsy to me (and will probably for you too).
I have a view controller (...
5
votes
1answer
85 views
Parsing travel duration data
I'm trying to parse an estimated travel duration and distance between two waypoints using Google Directions API. Tap on this to see an example of data received.
...
-2
votes
0answers
41 views
fatal error: unexpectedly found nil while unwrapping an Optional value [on hold]
I am trying to learn swift by making a piano app. When I try to run the app, I get an error:
...
-1
votes
0answers
54 views
View model class for Core Data — too many closures? [on hold]
This app I'm developing communicates with a backend API and store its data using Core Data. There's a point in my app where after a successful login, it should call the API, retrieve the data and ...
2
votes
1answer
44 views
Using NSPredicate with NSFetchRequest in a NSFetchedResultsController
I am learning CoreData and I wanted to have my code reviewed. As usual, I get something to work, then I attempt to refine it.
I have a data model that consists of an Item entity and a subItem entity. ...
2
votes
1answer
34 views
HMSegmentedControl react to tapping on currently selected segment
I'm using HMSegmentedControl, an open-source UISegmentedControl subclass. I'm trying to react to the user tapping on the currently selected segment. HMSegmentedControl only supports reacting to a ...
6
votes
1answer
80 views
Networking in iOS Swift
This piece of code is working - It gives me a lot of JSON back, which I have yet to parse, but I'd like to show my code here first to get tips on how to improve what I already have:
...
3
votes
0answers
77 views
Switching between view controllers that are loaded in the background
I have a dining menu app that scrapes the data from a website and redisplays it in a mobile format, displayed below:
If the user swipes left and right, the app will show the previous/next meal (ex. ...
-5
votes
1answer
76 views
Sum up all my web requests and make them static [closed]
Context:
I'm currently developing an iOS app in C#. I have different view controllers and sometimes also another view controller needs to make the same web request. I don't want to hold a reference ...
6
votes
2answers
60 views
Segue between view controllers using NIB files
I'm learning how to develop for iOS and I want to begin with nib's before storyboard to get a better understanding.
I just set up 3 view controllers:
...
4
votes
1answer
110 views
Closure as UIControlEvents handler
I'm expanding the functionality of this SO answer.
Mainly I'm focusing on:
You can add as many handlers as you want.
You can remove (i.e. cancel) the handler.
You can receive the ...
1
vote
2answers
56 views
Archiving data in file system for iOS
Being my first time archiving data to the file system, I would like to have my code reviewed. This simple test project works as expected, but I want to see if what I am doing is following best ...
3
votes
1answer
301 views
Pure Swift solution for socket programming
I have spend quite some time now to find out how exactly to do socket programming in Swift (Xcode 6.1). There are a few examples out there, but most of them no longer work for the latest release of ...
2
votes
0answers
73 views
Usage of MVVM in iOS [closed]
I'm an iOS developer and I'm guilty of having Massive View Controllers in my projects so I've been searching for a better way to structure my projects and came across the MVVM (Model-View-ViewModel) ...
2
votes
1answer
150 views
Subclass SKSpriteNode
I decided to subclass SKSpriteNode for a game test in Swift today and soon realised that it was not as simple as my Objective-C background suggested. After a little ...
4
votes
2answers
73 views
NSAssert or NSLog in defaults switch case
I am wondering if I should use NSLog(@"Switch out of range") or NSAssert(FALSE,@"Switch out of range"); in the following ...
5
votes
2answers
63 views
Consecutive animations
I'm new to Core Animations, I want to fade out two different layers one after another.I write them in a CATransaction block. I wonder if there is better approach to make such animations.
...
2
votes
1answer
147 views
Updating UITableView rows from Core Data
I am fetching or querying all the entries from my database (core-data) at three different times in my code, which I find to be an inefficient approach to writing the code.
The method ...
6
votes
1answer
100 views
Creating view rects in loop
I don't use constraints or IB to create views so it's easier to create rects this way. Does it wrong totaly?
...
4
votes
2answers
87 views
Fetch plist file
I have a plist file with many nested dictionaries inside of it, and I wanna fetch them all to my code. Isn't there any more efficient way to do that than nested for-loops?
...
7
votes
2answers
135 views
Defining a simple function-calling operator
I have been writing Swift code for a while and have read a lot of tutorials about how functional paradigms can be applied to Swift.
I defined a simple operator:
...
3
votes
0answers
101 views
UIScrollView Category utility function for auto sizing contentSize
I wanted a utility function on UIScrollView to automatically size the contentSize based on the content inside the scrollView. How is this?
...
3
votes
1answer
116 views
Error-handling #ifdefs for AFNetworking requests
I am using AFNetworking 1.4.3 to send and receive network messages in iOS. My application works slightly differently in DEBUG and RELEASE mode, so I need to use ...
1
vote
1answer
126 views
Correct Implementation of Custom UIView into ViewController Programatically
I am familiar with using scoreboards to construct UI elements in Xcode, but I am only beginning to learn how to make UI programmatically (with out storyboard).
I wanted to know if this is the correct ...
3
votes
5answers
371 views
Turning JSON objects into custom NSObjects
Was advised to post this question here after posting to Stack Overflow. I'm pre-populating a UITableView app with data using a local JSON file. The JSON itself is very simple:
...
4
votes
1answer
133 views
Core Data model for test-taking iOS app
I'm building an iOS app for test-taking and I want to be sure of my model before proceeding.
I found this post very helpful and tried to implement a simplified version for Core Data.
Here are some ...
3
votes
3answers
379 views
Determine if a string has all unique characters
I'm practicing algorithms (for future interviews) while learning about Big O notation and was wondering if there's a faster or more optimal way of writing an algorithm to see if a string has all ...
5
votes
1answer
358 views
Road to MVC: the case of Settings Table View Controller
Now that I know that MVC can help do better code, I want to make my SettingsTableViewController class conform to it.
...
1
vote
2answers
277 views
Repurposing UITableView infinite scroll configuration/properties
Had my first go at implementing infinite scrolling for UITableView's in my iOS app last night, and I noticed I ended up copying/pasting quite a bit of boilerplate from one VC to the next (if I wanted ...
15
votes
1answer
3k views
Rewrite code from Objective-C to conform with Swift power tools and concise style
I started a project with Objective-C and rewrote it with Swift. The project contains two UITableViewControllers: MasterViewController and DetailViewController. ...
6
votes
2answers
206 views
Array from file
I have this code which is performed each time I click the 'show polygons' button. The problem is that it takes a few seconds to finish running through the code before actually drawing the polygons + ...
3
votes
1answer
280 views
Images viewer from URLs with download progress
I've created an imageViewer that will be initialized with a String array, and will download and show the images as needed.
Alongside a review, could you give me a ...
3
votes
2answers
121 views
Keeping UI code DRY in iOS projects
I've subclassed UI button and used it in my View Controller's viewDidLoad method, like so:
...
3
votes
2answers
250 views
Thread-safe, in-memory LRU cache with a maximum item count of 10
I'm attempting to master LRU Caching. It must be thread safe, and it should preferably perform as well as web image-cache, (avg ~1MB).
Please take a look to see if there's anything wrong, amiss, ...
4
votes
1answer
68 views
Model class for networking that uses notifications
I just finished a model class that represents an Instagram Networking client for my iOS app.
I am specifically looking for a review of my use of static constants. These are strings that represent ...
6
votes
1answer
336 views
Clustering markers on Google map on zoom
I have a method that is getting called when someone zooms camera on the map (Google map).
I recalculate the positions of markers of map and the code is clunky and not effective. I iterate over arrays ...
2
votes
1answer
372 views
UISegmentedControl with view-animation
I have create a UISegmentedControl and a view under it. The view under contains all a view for each segment. I am doing an animation when the segment is changing.
...
-1
votes
3answers
203 views
iOS coding style
I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code.
...
5
votes
1answer
90 views
Showing a certain screen depending on a particular status
In this iOS app I'm working on, there are two landing screens shown to the user depending on a particular status. The screens are Login screen and Activate screen.
Let me explain what this Activate ...
12
votes
3answers
401 views
A flashing ! exclamation ! point ! bar
I have this Objective-C code for use in an iOS app that makes a 'bar' on the screen, with a red exclamation mark that flashes in it at random places.
Here's what it looks like:
Header file:
...
1
vote
2answers
824 views
Passing Row Index of TableViewCell (custom) to another view controller [closed]
I have been trying to achieve the below requirements to get them working. Am I doing it the right way?
We have a table with customised Cell (say: ...
3
votes
1answer
67 views
Potentially superfluous iOS interface system
I have written an interface system for iOS that allows interface elements to be moved around on the screen as actors move around on stage. It can operate within a ...
4
votes
1answer
115 views
Created 2 new classes to represent my backend service and persisted data in iOS app
I just created 2 model class for my iOS app:
HALUserDefaults represents the persisted data in my app. It has the ability to both retrieve persisted data and store ...
5
votes
1answer
259 views
Calculating delta in SpriteKit using Swift
I am attempting to learn swift by refactoring one of my old games and I need to rewrite my update method which calculates a delta time. This code works but is ugly. ...
11
votes
2answers
2k views
Is it still necessary to check for a front camera?
I'm trying to clean up redundant old code, so I'm asking this general question. Since all iOS 7 devices have a front camera, would it be safe to remove the code to check if the device has a front ...
5
votes
1answer
112 views
Cleaned up a small MVC refactor in iOS app
I have a view controller on my app, where the user is shown a table view. The table view displays their address book contacts and allows the user to select any friends that they would like to invite ...
3
votes
1answer
87 views
Very small start to MVC refactor in iOS app
I started to refactor my app to MVC today. I wasted a lot of time because of simple mistakes.
One was I kept trying to access the getter method inside of my custom getter method, which just causes ...
8
votes
1answer
440 views
Unhandled Exception handler that captures a screenshot
So, whether you're still in the development stages or your app is already on the app store, you always hope your app isn't crashing. But if it is, you want to be sure you've got good crash reports, ...
10
votes
1answer
186 views
First simple program; counting button presses
This is my first solo Objective-C program... it does the complicated task of displaying a button and counting how many times it's been pressed. It retains that count (along with the last time it was ...