Tag: swift

Swift UI Test – User Notifications System Alert

I’m trying to get past the User Notification system alert by following the flow presented in the follow post, which is the same flow mentioned in the UI testing cheat sheet and a few other posts on SO. Xcode7 | Xcode UI Tests | How to handle location service alert? I’m having a strange problem […]

Using custom SKNodes in spritekit scene editor

I want to create a level using my custom subclasses of SKNode. I tried adding an SKNode to the scene editor and using the “Custom Class” tab give the class that I want it to be but that did absolutely nothing. The node would still be empty and nothing would show when I run the […]

Passing an implicitly unwrapped variable into inout parameter doesn't compile

func someFunc<T>(obj: T, inout arr: [T]) { } var arr: [String]! someFunc(“a”, &arr) Upon calling someFunc(“a”, &arr), I get an error: [String]! is not identical to [T] arr is implicitly unwrapped, so shouldn’t it be treated as an unwrapped value, and thus able to be passed into the function? What then would be the correct […]

(setValue:) Cannot store object of type _SwiftValue at pictureURL. Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray

Having some issues understanding firebase with Swift 3. I’ve remade my observer to look like this: currentUserFirebaseReference.observeSingleEvent(of: .value, with: { (snapshot: FIRDataSnapshot) in let UID = snapshot.key let dict = snapshot.value as! Dictionary<String,AnyObject> let pictureURL = dict[“pictureURL”] as! String I used to just do observation….. in { let picture = snapshot.value![“pictureURL”] But now I guess […]

error: 'Int' is not convertible to '@lvalue Float'

Given the following function: func greatestCommonDenominator(first: Int, second: Int) -> Int { return second == 0 ? first : greatestCommonDenominator(second, first % second) } And a struct with the following stuff in it: struct Fraction { var numerator: Int var denominator: Int func reduce() { let gcd = greatestCommonDenominator(numerator,denominator) self.numerator /= gcd self.denominator /= gcd […]

Using Swift to handle GZipped (containing JSON) HTTP response

I have written Android apps that take GZipped Json data from a HTTP response. Now I want to write some IPhone apps that do the same thing. What class and approaches are needed to handle GZipped Json data using Swift?

Swift AVCaptureSession Close Open Button Error : Multiple audio/video AVCaptureInputs are not currently supported

I have a working barcode scanner code. When I click the openCamera button, first time everything is good. When I click the closeCamera button, good, but if I click again the openCamera button gives a fatal error. Code and error are below. In fact, is it possible to toggle camera view with one button? // […]

ScrollView in SpriteKit

I have found a few other questions and answers similar to this, but none of them quite work perfect for me. My vision is to have a horizontal scrollable view at the bottom of the screen where I can scroll through what will look like cards in a hand. Ideally, I could eventually make the […]

Could not code sign a Mac App

I successfully submitted my app [ version 1.0 ] to iTunesConnect for review. And they have rejected it because I have added an extra App Sandbox feature. So I solved that thing and tried to archive my project in new build number. Also I have selected my Code Signing Identity 3rd Party Mac Developer Application, […]

Segue Out of Navigation Controller

I am trying to leave the initial view controller, and go into the blank view controller. That is fine, but that would make the blank view controller also part of the navigation controller, which is not what I want. I want to segue out of the view controller. In the view controller I try to […]