Facebook's login opens the wrong app

I'm trying to implement the login of an app with facebook but every time I try to login, it suggests opening the wrong app. I've tried some things I found over here but it didn't work. On facebook's developers page I've added a suffix: And my .p...
more »

2017-06-18 23:06 (0) Answers

1 global function or many instance functions

If there are two similar classes that need the same function. Is it better to write the function globally, or write the same function twice inside each of the classes. Ex. Option 1: two instance functions class A { func buttonTapped() { ...
more »

2017-06-18 23:06 (3) Answers

Why is my tableView not being populated?

I'm trying to populate a basic tableview with sample data in code. Here's my ViewController: import UIKit class TableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var postTableView: UITableView! ...
more »

2017-06-18 23:06 (3) Answers

NSTableView Bindings doesn't work mac OS Swift

I'm trying to use cocoa bindings with nstableview and I have some problems with bind of parameter value of textfield: I'm using this code, class: class Person : NSObject { var givenName:String var familyName:String var age = 0 var lol = 0 overrid...
more »

2017-06-18 21:06 (1) Answers

How to run local host on Iphone using swift ?

I have a local ruby on rails server set up on - http://localhost:3000/ I have added allow arbitrary loads in the info.plist When I run the app on the simulator it works fine, but when I try to run it on the iPhone it doesn't. The app just crashes...
more »

2017-06-18 19:06 (2) Answers

Swift : fatal error: Index out of range

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) let order = orders[indexPath.row] guard orders.count > indexPath.row else { print("Index out ...
more »

2017-06-18 17:06 (1) Answers

Get location results from another class in swift

How to get location results from one class (GPSLocation) from (userLocation.swift) and use them in another class in file (target.swift)..? I need countryCode, city, longitude and latitude from: userLocation.swift import UIKit import MapKit class ...
more »

2017-06-18 13:06 (2) Answers

One button for several actions

I am having trouble configuring a button that: 1st press will do action 1 2nd press will do action 2 3rd press will do action 3 4th press will do action 1 5th press will do action 2 ...and so on Is there any way to configure that button? Thanks...
more »

2017-06-18 13:06 (3) Answers

Saving a File With SavePanel with Custom UTI

I often create my own document type for my desktop applications. But I have never registered my own custom UTI. Anyway, I want to save a simple Dictionary data as a data (NSData) file like the following. @IBAction func testClicked(_ sender: NSButt...
more »

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

Swift - display a sorted array with keys

I am want to display the three highest grades along with the names My code: let gradesofStudent = [ "Elias Brown": 80, "Baris Yan": 99, "Christian Najm": 70, "Sam Chakra": 90, "Alain Elliot": 55, "Georges Obama": 77, ] v...
more »

2017-06-17 22:06 (2) Answers

Swift 4 initWithObject equivalent

New to Swift. I have an Objective-C piece of code which looks like this: self.imageArray = [[NSMutableArray alloc] initWithObjects:@{@"name":@"James",@"image":@"1.jpg",@"Address":@"xyz"}, @{@"name":@"Doe",@"image":@"2.jpg",@"Addres...
more »

2017-06-17 20:06 (1) Answers

How to pass Leaf tag to another Leaf tag?

Is there a way to passing Leaf tag to another Leaf tag? For example, in my custom Leaf tag I return some html code: public func run( tagTemplate: TagTemplate, arguments: ArgumentList) throws -> Node? { return .bytes("<...
more »

2017-06-17 15:06 (0) Answers

Getting previous UIViewController swift

I want to get previous viewController. I have 2 UIViewControllers and navigationMenu when I select any row from navigation menu i want to get UIViewController from where menu opened to move to the second UIViewController. I want to know how to get...
more »

2017-06-17 13:06 (4) Answers

WKWebView CALayer to image exports blank image

I'm trying to take a screenshot of webpage but the image is always blank(white). I'm using this code to convert CALayer to Data(taken from here) extension CALayer { /// Get `Data` representation of the layer. /// /// - Parameters: /// - fileType...
more »

2017-06-16 22:06 (1) Answers