Tag: swift

Set Action for UITabBarItem

How can i set an action for my UITabBarItem ? Can i connect it from storyboard to code somehow? or programmatically? And if so how can it be done? My hierarchy is UITabBarController -> UINavigationController -> UITabBarItem Sorry for the noobish question but i really need an answer for this. And I couldn’t find anything […]

My Xcode 7.3 compiler is constantly breaking and causing extremely long Build and Compile times

This Issue Occurred On A SpriteKit Xcode Project I have an issue with Swift where, once my project reaches a certain level of complexity where I have tons of classes and methods around, my autocompletion breaks so that “Jump To Definition” ceases to work and my IDE is reduced to the usefulness of a basic […]

Uber SDK for iOS – get real time ride request status made via deep link

I’m having some trouble finding a way to do this. I got an app that uses Uber SDK for iOS. I was able to add the “RideRequestButton” with “Ride there with Uber” text to do a deeplink to the Uber app. Also, I’m done requesting the token using SSO and fetch the token with Request […]

How do I put an UIImageView in the center of a tableView

I want my image to be in the center in the x axis, I’m writing this code : let emptyImage=UIImageView(frame: CGRect(x: (UIScreen.main.bounds.width)/2 ,y: 200 , width: 50, height: 50)) but it doesn’t work.

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 […]