Tag: swift

XCode 9: SKEditorReference doesn't allow animations?

I can’t seem to get sprite nodes that have been added by reference (drag/drop one sks file into another sks file in XCode 9) to animate. This seems allowable, as you can physically do such a thing, but I’m unsure why the sub-nodes won’t animate. Example 1. Start with standard spritekit template 2. add a […]

Saving Data from a Label on multiple View Controllers

I have mulitplie View Controllers within an app which represent different levels within a game.. ViewController.swift SecondViewController.Swift etc On each of the different levels there is a several buttons, 1 which is the correct answer and 2 which are incorrect. on each view controller i also have labels that update the score of the user […]

Calling report achievements performance?

If I have a Mario running and every step he takes I call this function: static func updateRunAchievement(steps: Int) { guard steps > 100 else { return } let achievement = GKAchievement(identifier: “marioran100steps”) achievement.percentComplete = 100 let achievementArray: [GKAchievement] = [achievement] GKAchievement.reportAchievements(achievementArray, withCompletionHandler: { (error) in if error != nil { print(“error: \(error)”) } }) […]

Value of type 'UIViewController' has no member 'varView'

Please help fast override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { var DestVC = segue.destinationViewController as UIViewController var indexPath : NSIndexPath = self.tableView.indexPathForSelectedRow! DestVC.varView = indexPath.row // This is the error line } The error is Value of type ‘UIViewController’ has no member ‘varView’

Trying to set the tab order in XCode for OSX App

I’m building an OSX Desktop app with XCode 7.3 and I’m trying to set the tab order for one of the forms. I’ve found a couple of posts explaining a similar problem for XCode 4 but not getting anywhere with it, https://www.youtube.com/watch?v=SRrE8eqp0dU The basic problem i’m trying to fix is when the user is in […]

swift ios alpha numeric regex that allows underscores and dashes

I am using this lib for validation and are trying to add my own regex. What I want to do is to make a regex that allows alphanumeric A-Z 0-9 together with dashes and unserscores -_ I have tryed let regex = “[a-zA-Z0-9_-]” but I cant get it to work. I also want the regex […]

How can i start developing app on watchOS 3 SDK?

I can’t find latest watchOS 3 SDK inside latest version of XCode 8 beta 2 even though they have mentioned it in their release notes. I have upgraded my Apple Watch to watchOS 3 beta 2 but I can’t run my app on it: Error: No symbols for paired Apple Watch

Swift Class/Protocol is not recognised by Xcode compiler or Auto Complete

When you create a new file in your Swift Xcode project, e.g.: a new class. It gets created successfully however it seems unable to be used or found in the auto complete. Eg: I create a class FooBase and then try and create a second class that inherits from FooBase – Class Foo:FooBase FooBase does […]

XCODE Swift Replacing HTTP-Get App-ID with a space

Sup dudes, Working on creating a Bing Image Search API for Swift. My problem is that my app key contains ‘+’ and ‘/’ so when I make a request, I’m getting back because it seems that it treats ‘+’ and ‘/’ as spaces. It should treat everything before the query as a regular character, right? […]

How to get multiple locations of multi touch UITapGestureRecognizer

I have a UITapGestureRecognizer in my view and I can get the location of its touch with below code fine. Now if I change this recognizer’s number of touches to 2 (or more), it still gives me one location. How can I get two locations of the two touches? tapGesture.locationInView(self.view) Kindly help in swift.