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

How do I store a Swift Struct in Core Data on iOS?

At the moment I’m storing one of my classes as NSData in a plist and obviously that isn’t a good way to do it. So I’m trying to set up Core Data, but my class has Structs. This is what I have: import Foundation import CoreData class Favourite: NSManagedObject { @NSManaged var origin: Stop struct […]

UIDatePicker not displaying correctly

Basically this issue started when I updated my app to run with iOS 9. Without making any change in the code now a white square appears over the picker view, but it works normally. Note that the user can hide and show the picker views and the cells they’re in. If you need more info […]

Resizing the height of UILabel to fit text

I have UILabel in my Cell Subclass which is suppose to hold a title. The size of the title can be various lengths and therefor I need to resize the UILabel to fit the text and to prevent that the text is not to long I also need to be able to set maxHeight. The […]

Proximity sensor in Swift (from Objective-C)

I’m a relatively new user to swift and now, I need to take advantage of the proximity sensor of an iPhone. I don’t matter the distance, but I want to know when something is near the iPhone. So I found this code in Objective-C that worked, but I need it in Swift. I have tried […]

How can I customize the title/subtitle font in callout from MKAnnotationView or just hide them?

I have a view to a calloutDetail: annotationView.detailCalloutAccessoryView = mapInformationView.view It is working just fine, but I don’t want to display a title/subtitle, just my custom view. But when I left title/subtitle empty the callout isn’t displayed. So, How can I hide them or just change their font size and name?

Change UIPicker color

How can I change the color of my picker? I don’t wish to change the font or the text. My picker is populate and works exactly how I want it, what I want to do is change the color from black to my custom white.

How to call a factory method of an Objective-C class from Swift?

I have an obj-c class that uses a factory method to instantiate itself as a singleton. I added that class to my Swift bridge header and want to call this factory method from a swift class. However, XCode won’t let me. The obj-c code is: @interface MOAssistant : NSObject { … + (MOAssistant *)assistant; @end […]

Type 'Int32' does not conform to protocol 'AnyObject' Swift?

I have a Model, subclass of NSObject, looks like as below. class ConfigDao: NSObject { var categoriesVer : Int32 = Int32() var fireBallIP : String = String () var fireBallPort : Int32 = Int32() var isAppManagerAvailable : Bool = Bool() var timePerQuestion : String = String () var isFireballAvailable : Bool = Bool () } […]

How can I move an image in Swift?

I would like to be able to move an object (in my case, an image “puppy”) up 1 pixel every time a button is pressed. I’ve stumbled upon old Objective-C solutions as well as Swift code that was similar, but none that fit my specific problem. I would love to know an easy way to […]

“Unknown class in interface builder file” when using class which inherits from a generic class in a Storyboard

I recently refactored my class BookTableViewController from a simple inheritance from UITableViewController, so that it now inherits from a generic class FetchedResultsTableViewController<TResultType, TCellType> which itself inherits from UITableViewController. The class declarations look like this: class BookTableViewController: FetchedResultsTableViewController<Book, BookTableViewCell> { override func viewDidLoad() { // breakpoints in here do not catch! } } class FetchedResultsTableViewController<TResultType, TCellType: […]