Tag: swift

Where are the swift/swiftc binaries for v3?

I’ve just downloaded the Xcode 8 beta, and am struggling to figure out where the swift and swiftc binaries are hidden. The Swift website says that the toolchain should be available at /Library/Developer/Toolchains and that it can be exported for use on command line with: $ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:”${PATH}” But that path doesn’t seem to exist […]

Get 'Touch Drag Inside' Distance When Setting IBAction From Storyboard

I know how to set UIPanGesture events and recognizers and get the data I need when I create them programatically. However I am trying to learn how to work with the storyboard and use IBOutlets. I have dragged over an IBAction for ‘Touch Drag Inside’. @IBAction func dragButtonDragEvent(sender: AnyObject) { println(sender) } The problem is […]

Wiring up Outlet Collection Trouble

From what I can tell there are some challenges people are having in XCode6 in terms of wiring up outlet collections. I just wanted to see if i’m doing this right or what I need to do correctly! I reviewed here Can't hook up an outlet collection in Xcode 6 using storyboard as well as […]

Xcode/Swift error: Command failed due to signal: Segmentation fault: 11

I am trying to call a function of a singleton class with completion handler argument but I get “Command failed due to signal: Segmentation fault: 11” error. I am using Xcode 6.2 (6C101) and trying to build for iOS 8 on iPhone 6 simulator. Here is the singlton class: public class ClientManager { public class […]

Simplify dictionary (xcode keeps indexing forever)

So I’ve encountered a bug, where xcode starts indexing my files forever, using all the processor time. I googled this problem and managed to understand that the following code is causing this bug: private struct Database { let db = [ “oasis” : [ “id” : “oasis”, “sector_id” : “oasis”, “name” : “Oasis”, “type” : […]

UIPickerView won't display the data loaded from NSUserDefaults – App is crashing while loading data

I made a first try to use NSUserDefaults in an App with UIPickerViews. But the App is crashing while testing / the data isn’t displayed in the PickerView. I still try to fix it myself but some help would be great. ViewController3: Where the user should save data to the NSUserDefault. Therefore there is an […]

Node movement lag in Spritekit, Xcode

In my game I have a node that the player controls with the PanGesture. When the PanGesture function is called, it adds its velocity to that of the Node in question, making it move. However, I have encountered a problem where the Node (under specific yet inconsistent circumstances) moves slower and not as smoothly as […]

Can an Obj-C AXObserverCallback be converted to Swift?

Can an AXObserverCallback be converted to Swift? The problem I am having seems to be with the void* which I know is not a valid type in Swift. I am attempting to convert Obj-C code to Swift and I am unable to get the code to compile. I am uncertain if the AXObserverCallback can be […]

Whats the easiest way to empty and save a Core Data Table in Swift?

So I have a entity, which I am treating as a simple Database Table in iOS8 XCODE and SWIFT. I want to delete every entry in the table. Permanently. So when I start up the app again they do not reload.This is my code. func deleteAllItems(){ println(“All Items are being DELETED”) var count:Int = 0 […]

Swift NSLocale Simulator iOS 8

I’m having an issue with Swift and the iOS 8 Emulator in XCode 6.1. Indeed when I try to use NSLocale, almost every functions of it return nil. Here is how I use it: let cc = “fr” // Example let locale = NSLocale.currentLocale() let countryName = locale.displayNameForKey(NSLocaleCountryCode, value : cc) println(countryName) // Shows : […]