iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

How to get device make and model on iOS?

I was wondering if it’s possible to determine what kind of iPhone (for example) the currentdevice is? I know it’s possible to get the model through NSString *deviceType = [[UIDevice currentDevice] model]; which will just return whether I have an “iPhone” or an “iPod”, BUT I was wondering if it’s possible to detect/know if I […]

Returning method object from inside block

I am wondering how to do the following correctly: I have a method that is to return an NSData object. It gets the NSData object from a UIDocument. The NSData object can get large, so I want to make sure it is fully loaded before the response starts. I would therefore like to return the […]

ios app maximum memory budget

I’m working on an ios game that’s targeting as a minimum the 3gs. We are using HD assets for retina display devices (iphone 4, ipod touch 4th gen). Memory wise, Ipod Touch 4th gen seems to be the most constraint device for us since it has the same amount of RAM (256 compared to Iphone […]

(Apple) GameplayKit State Machine implementation with SKScene

I’ve read up on the GameplayKit State Machine and the documentation explicitly mention Game UI as an example of usage. Im fully understanding the concept but I am unsure how to implement it while using SpriteKit. Lets say I want 3 states. Menu, Gameplay and Game Over – All which display content to the SKScene. […]

UITextField text change event

How can I detect any text changes in a textField? The delegate method shouldChangeCharactersInRange works for something, but it did not fulfill my need exactly. Since until it returns YES, the textField texts are not available to other observer methods. e.g. in my code calculateAndUpdateTextFields did not get the updated text, the user has typed. […]

How to use NSURLConnection to connect with SSL for an untrusted cert?

I have the following simple code to connect to a SSL webpage NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url]; [ NSURLConnection sendSynchronousRequest: urlRequest returningResponse: nil error: &error ]; Except it gives an error if the cert is a self signed one Error Domain=NSURLErrorDomain Code=-1202 UserInfo=0xd29930 “untrusted server certificate”. Is there a way to set it to accept connections anyway […]

How to write iOS app purely in C

I read here Learn C Before Objective-C? Usually I then replace some Obj-C code with pure C code (after all you can mix them as much as you like, the content of an Obj-C method can be entirely, pure C code) Is this true? Is it possible to build an iPhone app purely in the […]

Why does `ordinality(of: .day, in: .era, for: date)` give the same result for 2 dates in different time zones?

Consider the following code: import UIKit let date = Date() guard let nycTimeZone = TimeZone(abbreviation: “EST”), let nzTimeZone = TimeZone(abbreviation: “NZDT”) else { fatalError() } var nycCalendar = Calendar(identifier: .gregorian) nycCalendar.timeZone = nycTimeZone var nzCalendar = Calendar(identifier: .gregorian) nzCalendar.timeZone = nzTimeZone let now = Date() let nycDayOfEra = nycCalendar.ordinality(of: .day, in: .era, for: now) let […]

How to determine the current iPhone/device model?

Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift? I know there is a property named UIDevice.currentDevice().model but it only returns device type (iPod touch, iPhone, iPad, iPhone Simulator, etc). I also know it can be done easily in Objective-C with this method: #import <sys/utsname.h> […]

Fast and Lean PDF Viewer for iPhone / iPad / iOs – tips and hints?

There has been many Questions recently about drawing PDF’s. Yes, you can render PDF’s very easily with a UIWebView but this cant give the performance and functionality that you would expect from a good PDF viewer. You can draw a PDF page to a CALayer or to a UIImage. Apple even have sample code to […]