iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

How do I generate an auth token using JWT for Google firebase?

So I’m trying to authenticate the Firebase REST API. I’m using the Vapor framework for server side swift and I installed the JWT package. I’m trying to use the data in the serviceAccountKey.json file and JWT to generate an auth token. Here is the code I’ve tried: let payload = try JSON(node: [ “iat”: Date().timeIntervalSince1970, […]

fatal error: high- and low-surrogate code points are not valid Unicode scalar values

This question already has an answer here: How can I generate a random unicode character in Swift? 2 answers

Custom cell: fatal error: unexpectedly found nil while unwrapping an Optional value

I have a table view with custom cell that was created as .xib . I didnt use storyboard. I have a problem that I couldnt fill my table with the data which came from webservice result. Also, I have 4 labels in the custom cell. In my custom cell class, when I try to set […]

Zoom in on User Location- Swift

I can’t figure out how to get the map to zoom in on the user location from viewDidLoad. I tried setting a region, and that didn’t work. This is the code I have, any tips? @IBOutlet weak var mapView: MKMapView! var MapViewLocationManager:CLLocationManager! = CLLocationManager() var currentLocation: PFGeoPoint! = PFGeoPoint() override func viewDidLoad() { super.viewDidLoad() self.mapView.showsUserLocation […]

How to check that the string is not nil in swift?

If I declared a String like this: var date = String() and I want to check weather its a nil String or not so that I try something like: if date != nil{ println(“Its not nil”) } But I got an error like : Can not invoke ‘!=’ with an argument list of type ‘(@lvalue […]

Getting data out of NSData with Swift

I am finding Swift and NSData to be an unholy matrimony of frustration. I find I feel like all the supposed new found Swift safety goes out the window every time I deal with this thing. The amount of crashes (with unhelpful traces) don’t help. So, I’ve learned, that I can avoid the scary UnsafeMutablePointer […]

swift iOS – UICollectionView images mixed up after fast scroll

I am new to swift and iOS programming, but I have been able to build a mostly stable starting interface for my application in Xcode. The CollectionView grabs an image and text from an array of dictionaries created from a csv file on my home network server. The cvs file contains data in the following […]

Why sending message from WatchKit extension to iOS and getting back a reply is so slow?

I am using sendMessage method to send a message from WatchKit extension to an iOS app. It takes about 230 ms on average to receive a reply. The time does not depend on whether the iOS app is on screen or running in the background. 230ms is roughly the time it takes for light to […]

Alamofire POST request with progress

I’m using Alamofire to do a POST request. As this POST request can take a while and I want to keep track of the progress and display it as a ProgressView. Alamofire.request(.POST, ApiLink.create_post, parameters: parameters, encoding: .JSON) .progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) -> Void in println(“ENTER .PROGRESSS”) println(“\(totalBytesRead) of \(totalBytesExpectedToRead)”) self.progressView.setProgress(Float(totalBytesRead) / Float(totalBytesExpectedToRead), animated: true) […]

How do you hash a string to SHA512 in Swift?

I am building a social media application and I would like some help encoding a password string to SHA512 in Swift. I found the CryptoSwift library on GitHub but I am having a hard time loading it into my Swift project and linking it to my project files. Does anyone know how to accomplish this […]