ARKit Place a SCNNode facing the camera

I'm using ARKit to display 3D objects. I managed to place the nodes in the real world in front of the user (aka the camera). But I don't manage to make them to face the camera when I drop them. let tap_point=CGPoint(x: x, y: y) let results=arscn_vi...
more »

2017-09-13 13:09 (1) Answers

Detect if the device is iPhone X

My iOS app uses a custom height for the UINavigationBar which leads to some problems on the new iPhone X. Does someone already know how to reliable detect programmatically (in Objectiv-C) if an app is running on iPhone X? EDIT: Of course checking...
more »

2017-09-13 10:09 (7) Answers

Swift 3 to 4 Migration Errors when button clicked

I have an array of images that you scroll through by clicking a button. I migrated to Swift 4 today and now instead of remaining on the same page and scrolling through the images, it switches back to the home tab when the button is clicked. It was ...
more »

2017-09-13 05:09 (1) Answers

How to get stringValue from a NSTextView

I am creating a OSX Cocoa Application using Swift. I am trying to get the input from a NSTextView to my paste board. @IBOutlet var issues: NSTextView! @IBAction func button(_ sender: Any) { let stringvalue = "Issue: \(issues.StringValue)" ...
more »

2017-09-13 02:09 (1) Answers

"'NSOffState' is unavailable in Swift"

I have an extension of NSView with a simple function called clearControllersInView() which takes all the controllers in the view and sets them to a default value (i.e. checkboxes to off, popups and combos to first menu item, textfields to empty strin...
more »

2017-09-12 19:09 (1) Answers

Prevent escaping brackets in URLs

Our image server allows us to pass url parameters that trigger certain image manipulation operations. For instance the url https://www.example.com/i/example/10570250?layer0=[w=600&h=1000&bg=rgba(228,228,228,125)&cm=multi] scales the image...
more »

2017-09-12 18:09 (1) Answers

iOS apps taking up loads of space on phone

The other day I made a weather app, with 3 labels, a textfield, and an image (2.1mb). When I installed it from Xcode on to my iPhone 5C, I was surprised to see the huge amount of space it took up (around 40mb). I thought this could be to do with so...
more »

2017-09-12 17:09 (1) Answers

Many errors in project with Cocoapods

I am trying to use CocoaPods to install some libraries written in Swift: Fusuma, TLPhotoPicker, DKImagePickerController But every time I get ~300+ errors. First, I thought, that libraries are not supporting Swift 3, but in github repositories there ...
more »

2017-09-12 16:09 (1) Answers

Making UIButton Wrap Following a UILabel

We have a multi-line text-wrapping UILabel with some text in it. At the end of the label we want to always place a UIButton as shown. What's the simplest way to implement this? The text in the button must not break i.e. the button must flow on to ...
more »

2017-09-12 15:09 (1) Answers

Swift Facebook Login no url after logout

I've implemented this in my app: https://developers.facebook.com/docs/swift/login/ I've pretty much followed this to a tee, except that I have two view controllers with this implementation; one outside of a navigation controller for login (1), one in...
more »

2017-09-12 11:09 (0) Answers

Generics variable declaration in Swift

I have created a simple code in playground. class CarBrand { } class Bmw: CarBrand { } class Mercedes: CarBrand { } class Car<T: CarBrand> { } class Employee { var car: Car<T: CarBrand>?// of cource this doesn't work, bu...
more »

2017-09-12 09:09 (2) Answers

Mutex alternatives in swift

I have a shared-memory between multiple threads. I want to prevent these threads access this piece of memory at a same time. (like producer-consumer problem) Problem: A thread add elements to a queue and another thread reads these elements and dele...
more »

2017-09-12 08:09 (3) Answers

GPUImage doubles image size - iOS/Swift

I am trying to convert an image into grayscale one using GPUImage. I wrote an extension to get my work done. Grayscale thing is okay. But output image has become doubled in size. In my case I need the image to be in exact size. Can someone please hel...
more »

2017-09-12 08:09 (2) Answers

iOS state restoration issue with DrawerController

I have an app written in Swift 3.1, using Xcode 8.3.3. I am currently trying to implement state preservation/restoration. To do this I have implemented shouldSaveApplicationState and willFinishLaunchingWithOptions methods in AppDelegate.swift and s...
more »

2017-09-12 05:09 (1) Answers

inner shadow effect UIView

I want to add inner shadow to this UIlabel Picture: reference form Inner shadow effect on UIView layer? let display = UILabel() func setBackgroundLayer () { let backgroundLayer = CAGradientLayer() backgroundLayer.frame = view.bounds...
more »

2017-09-12 01:09 (1) Answers

Best way to "eat" something in SpriteKit

By "eat" I mean: when sprite A (Mario) collides with sprite B (a coin) the collision is detected and the coin is removed from the scene; however, Mario's movement is not altered by the collision with the coin. At the moment I'm using SKPhysicsContac...
more »

2017-09-12 00:09 (2) Answers

Swift OSX NSOpenPanel not changing selection

I am calling a NSOpenPanel so the user can select a file, but after the first selection is done the panel doesn't allow me to change the file when I click with the mouse on another file. It changes when I use the keyboard arrows but it doesn't when I...
more »

2017-09-11 23:09 (0) Answers