How to set system font for CATextLayer()?

Swift
For UILabel, I can set the system font as: label.font = UIFont.systemFontOfSize(18, weight: UIFontWeightMedium) For CATextLayer, is there a similar...
3 years ago

Access GPS coordinates from metadata dictionary

Swift
I need to take a photo with the camera and get its GPS coordinates but the problem is that metadata dictionary is no returning the {GPS} key and I don...
3 years ago

How to catch error while parsing json without using if for each key?

Swift
here is How i parse json: let myObject = MyObject() let string1 = if jsonObject["string1"] as? String{ myObject.string1 = string1 }else{ throw ...
3 years ago

UITableView with custom cells is empty

Swift
I have a two custom cells implemented: class TextFieldCell: UITableViewCell{ var label = UILabel() var textField = UITextField() overrid...
3 years ago

Merge few lists into dictionary

Swift
I have 3 lists: a = ["John", "Archie", "Levi"] b = ["13", "20"] c = ["m", "m", "m", "m"] I want to merge this into one list with dictionaries: ...
3 years ago

Testing optional for nil and switching nil to 0

Swift
I am working on a simple app where I need to add two numbers entered in a text field together. I want to make it so that if on of the textfields doesn...
3 years ago

Cast class type retrieved from string

Swift
I'm trying to read a class from a String and pass its type to a generic function. But it seems like there's no way to achieve this: protocol Person {...
3 years ago

How to change SearchBar border color

Swift
I would like to change grey border color in my Search Bar to white color. Now it looks like that: I achieved this effect after using this lines of ...
3 years ago

Swift - How can i load a function only once?

Swift
I want to make a app, where you are getting 1 point each second, and it all works fine. But since i have multiple view controllers, then timer runs ag...
3 years ago

Warning: A long-running operation is being executed on the main thread. try! get data(). Swift

Swift
I know that the error comes from try! converyPFFile.getData() Wondering how to get rid of the error if I don't want to get data in background because...
3 years ago

Confused with Swift Where Clause.

Swift
So i'm still learning but i'm struggling to understand a certain part of this code: case let newSquare where newSquare > finalSquare: // di...
3 years ago

Understanding CATransform3DRotate / CATransform3DMakeRotation

Swift
I'm trying to understand how to create depth perceptive to my UIView like this : I've tried this code: var rotationWithPerspective = CATransform3D...
3 years ago

want to disappear keyboard in uitextview

Swift
i'm using uitextview in swift and for keyboard disappear i'm using uitextview delegate method func textView(textView: UITextView, shouldChangeTextInR...
3 years ago

Realm Swift - Retrieve Objects by filtering on relationship

Swift
Here is my problem... I am looking around and trying all kind of things but it doesn't work... Surely nothing amazing but I got stuck. I have 2 table...
3 years ago

Passing data between unrelated view controllers

Swift
How to pass data between two different (unrelated) view controllers? From my understanding of delegates, a relationship of some sort is required (eg. ...
3 years ago

Input from the keyboard in command line application

Swift
I am attempting to get the keyboard input for a command line app for the new Apple programming language Swift. I've scanned the docs to no avail. im...
3 years ago

Button not firing event

Swift
UIButton inside scrollview is not firing event..I tried setting exclusiveTouch delaysTouchesEvent.But none help. class TestViewController: UIViewCont...
3 years ago

Downloading JSON with NSURLSession doesn't return any data

Swift
I am currently trying to download, parse and print JSON from an URL. So far I got to this point: 1) A class (JSONImport.swift), which handles my impo...
3 years ago

How to distinguish which item has been selected in UITableViewCell

Swift
I'm trying to create a project similar to Instagram. When you select user, it brings you to user VC. When you select comment, it brings you to comment...
3 years ago

Background color change in Xcode

Swift
I'm hoping to make a basic iPhone app where the background color changes every time a certain button is pressed by the user. I'm wondering if this cod...
3 years ago