Cocoa application with SPM

My general goal is to create an app, that grabs all data from the postgreSQL database. Firstly, I connected C API libpq to connect my database. Then, I found a nice wrapper around libpq to make my life easier, thanks to Perfect. To install this wrapp...
more »

2017-01-11 22:01 (1) Answers

Use one or multiple SKScenes for Level based Game

I'm making a level based game using SpriteKit. I would like to know the best practice for making level changes. I was originally using one Scene as my gameplay scene and when a level is completed, it removes all nodes in the scene and then adds the o...
more »

2017-01-11 21:01 (1) Answers

Custom UICollectionView in Swift 3 not working

So I am new to swift and am trying to create a custom UiCollectionView that you can horizontally scroll through, and when tapping on a button, you can add an image from your camera roll to the array of images in the collection view. This is what I ha...
more »

2017-01-11 19:01 (1) Answers

Get Data from UUID in Swift 3

I have the following code written in Objective C that I am trying to get working in Swift 3. Some of the functions equivalents do not appear to be available in Swift 3. Here is the code is the code in Objective C NSUUID *vendorIdentifier = [[UIDevic...
more »

2017-01-11 19:01 (2) Answers

Alamofire memory leaks Instruments

I am trying to clean my app from memory leaks and I have a few problems understanding this Why Alamofire function Request.serializeResponseJSON is called 30 seconds after I've launched app: I did not touch anything or navigate anywhere, the scree...
more »

2017-01-11 16:01 (0) Answers

Get all available characters from a font

I am developing an iOS app in Swift 3. In this app I am listing all available fonts (system provided) but I would like to list all available characters for them too. For example I am using Font Awesome to and I want the user to be able to select any...
more »

2017-01-11 14:01 (2) Answers

Detect ethernet - wifi network change

I want to detect when the network changes from ethernet to wifi (or wifi to ethernet). I want to have an observer to notify me about this change. reachability isn't good enough - it's always returns ReachableViaWiFi for both cases. P.S - There wer...
more »

2017-01-11 13:01 (0) Answers

Generic NSPredicate

I'm trying to create a function which returns a NSPredicate. Currently I have: func predicate(value: String, op: String, predicate: String) -> [NSPredicate] { return [NSPredicate(format: "\(value) \(op) %@", predicate)] } func predicate(val...
more »

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

Dramatically long Swift compile time

I like Apple, I like things that they do, but Swift... oh I have a problem with Swift compile time on my machine. Configuration: MacBook Pro (Retina, 13-inch, Mid 2014) 2,6 GHz Intel Core i5 8 Gb 1600 MHz DDR3 SSD 256 (up to 800 mb/s) About tes...
more »

2017-01-11 08:01 (1) Answers

swift - using .map on struct array

i have a struct array that i want "break up" into smaller arrays that can be called as needed or at least figure out how i can map the items needed off one text value. the struct: struct CollectionStruct { var name : String var description...
more »

2017-01-10 22:01 (3) Answers

How to convert Objective-C line to Swift?

I have code in Objective C: NSMutableArray* paths = [textView.textContainer.exclusionPaths mutableCopy]; and now when I try to convert it to Swift: self.textView.textContainer.exclusionPaths(mutableCopy()) it gives me error: Cannot call value ...
more »

2017-01-10 22:01 (3) Answers

Swift 3 changing date format

I want to get my Date in DD.MM.YYYY HH:mm:ss as a String. I use the following extension: extension Date { var localTime: String { return description(with: Locale.current) } } and the following code when my datePicker changes: @IBAction ...
more »

2017-01-10 21:01 (1) Answers

Why can't I read those MTLTexture pixels?

I am trying to get the pixels of a MTLTexture this way: let pixelCount = compareTexture.width * compareTexture.height let region = MTLRegionMake2D(0, 0, compareTexture.width, compareTexture.height) var textureComponentsArray = Array<float4...
more »

2017-01-10 21:01 (0) Answers

Json Parsing Swift 3 Alamofire

I am new at swift 3.00 and I got problems with getting Json return then sending request. I am trying to send post request to server with parameters username and password and get respond with Json with information, but I haven't been able to get the d...
more »

2017-01-10 19:01 (1) Answers

Present active searchBar on segue swift

I have two view controllers. A view controller with a button, and a view controller with a UITableView and a UISearchBar. When the user taps on the button in the first view controller, the app should segue to the table view and immediately present ...
more »

2017-01-10 18:01 (0) Answers

How to know a UIComponent width at runtime?

I have a UIComponent which is a simple view (I narrowed the problem). Here is the xib and class : Then I put this component in a view in the storyboard, sets its constraints: So normally the red rectangle has different width value depending on ...
more »

2017-01-10 18:01 (2) Answers

RxSwift extending Observable generic type issue

I'm having trouble writing some RxSwift utility function. I want to create a utility function maps multiple Observable<Bool> streams to a single Observable<Bool> stream, which checks if every source streams are true. It can be achieved by...
more »

2017-01-10 16:01 (1) Answers

How do I get the File Kind of a URL?

I was using this to get the file kind string from a given URL var umKindStr: Unmanaged<CFString>? = nil LSCopyKindStringForURL(url, &umKindStr) if let kindStr: CFString = umKindStr!.takeRetainedValue() { return kindStr as String ...
more »

2017-01-10 14:01 (0) Answers

Don't want to download all objects

I'm having a hard time understanding how I should structure my iOS app with regards to how Firebase works. I've got a few thousand users with my current implementation (not using firebase currently), but using .childAdded will give me all of the item...
more »

2017-01-10 14:01 (2) Answers