Tag: swift

XCode says 'Use of undeclared type' when trying to use a protocol defined inside a private Pod (Swift)

I and my team are stuck in a strange situation involving a base project + private pods with some protocols inside. Our problem is we can’t access some of the (protocol) identifiers (defined in a private pod) from our base app code. Apparently our problem seems to be exactly the same as the one described […]

Firebase Query not Executing Properly

I am trying to execute a Firebase query and it doesn’t seem to be working properly. I am trying to access the name of a School I have in the Firebase Database. The database looks like this: Schools { Random School Name { schoolLocation: Random Location uid: random UUID } } If I use the […]

How do you debug on breakpoints in swift on xcode?

I face trouble using po/p command in xcode using swift. It doesn’t work always and gives error most of the time. Also its response is not useful most of the time. For example, when i type “po user” it gives instead of its details and items which i could expand while using objective-c How do […]

Swift – App getting crashed in IOS 8.4 on launch with error _NSURLSessionTaskPriorityDefault

App is getting crashed on launch, with error log dyld: Symbol not found: _NSURLSessionTaskPriorityDefault Referenced from: /private/var/mobile/Containers/Bundle/Application/E302B99F-08D3-45C0-A8ED-F500052FF375/AppName.app/AppName Expected in: /System/Library/Frameworks/Foundation.framework/Foundation in /private/var/mobile/Containers/Bundle/Application/E302B99F-08D3-45C0-A8ED-F500052FF375/AppName.app/AppName IOS Target Version : 8.0 Swift : version 2.2 Device: Iphone 6 Device Version 8.4

Firebase erroneously shows deleted data / Swift 3 / Xcode 8.2

I am new to coding and just started using Firebase, and I am running the below function which is basically trying to create 2 nodes, “Tournaments” and “Daily Games” (if they don’t exist already). The database tree should look like this: -London -City Game -Date(stringDate) // getting this from another function, returns 2016-16-12 -Tournaments -Daily […]

IBDesignable view not rendering

I have a simple @IBDesignable view that I have specified as the base class for a scene in my macOS storyboard. E.g., in Xcode 8, Swift 3: @IBDesignable class OvalView: NSView { @IBInspectable var strokeColor: NSColor = .black { didSet { needsDisplay = true } } @IBInspectable var brushSize: CGFloat = 5.0 { didSet { […]

save current user to relation in parse with swift

I have a system where when the current user accepts a request my app adds a relation between the user that sent the request to the current user. However I want to also have the current user added to the other user’s relation so that it is not just the current user that has a […]

How do you convert optional text input to Int in Swift 2, Xcode 7 beta using if let – toInt does not work

I’m having trouble converting optional input String to Int in order to do calculations on it. let odoField = UITextField() // allows entry of text to iOS field odoField.text = “12500” // simulated input let odoString = odoField.text // now here is where I get trouble… if let odoInt = odoString.toInt() { distance = Double(odoInt) […]

How to swipe right to show new View Controller in Swift 3?

I want to be able to swipe right in my ViewController which will show another view controller, CommunitiesViewController. I have looked on other threads and found some ways of doing this though I believe they are for Swift 2. This is the code I am using in my ViewController: override func viewDidLoad() { super.viewDidLoad() let […]

Create UITextField Extension in Swift with custom styling

I have several UITextFields on the view that have to look the same. I figured out that I might create an Extension that will pre-style my text fields (those that I want to have the same style). let passTextField: UITextField = { let tf = UITextField() //tf.backgroundColor = UIColor.blueColor() tf.translatesAutoresizingMaskIntoConstraints = false tf.layer.cornerRadius = 25 […]