#swift
9 posts tagged swift. Clear filter
-
Parsing URL Parameters with Swift
Here is an extension you can use in your Swift (v4) projects that makes it easy to parse parameters from a url. Given a url like, "http://example.com/?x=1&y=2", you can extract the x and y...
-
How to Chunk Large Files in Swift
How to Chunk Large Files in Swift (4.1) It takes a bit of work but this is the solution I found that finally worked, thanks to this Stack Overflow thread...
-
How to Get GPS Location Information from Address String with Swift and iOS CLGeocoder
You can use CLGeocoder geocodeAddressString method. It will return an array of CLPlacemark objects that contain gps coords and city, location info. let address = "Burlington, Vermont"...
-
How to Get GPS Location Information from a Photo or Movie with Swift and UIImagePickerController
This code assumes you're using the UIImagePickerController. If not you will need to get an image url another way. But, If you are using UIImagePickerControllerDelegate then it will supply the...
-
How to Dynamically Call a Method from a String in Swift
You have to subclass NSObject class Car : NSObject { func drive(){ print("Driving..") } } let car : Car = Car() car.perform(NSSelectorFromString("drive"))
-
How to Check if Your iOS or MacOS App is Connected to the Internet
Is your app connected to the internet? You can use this standalone class to check! There are no dependencies so you can copy/paste it into your project without needing to install another framework....
-
How to Flush or Erase Cache of Your XCode iOS or MacOS Cocoa App
If you're working with an XCode application, either iOS or MacOS, and want to do a completely clean build and delete the cache, it's simple. Execute this command from the command line.. defaults...
-
How to Find the Directory Locations Your XCode App Uses
You can add this snippet to your application, say for instance in your viewDidLoad function, that will print to the XCode console, the location of your app while it's being developed. // prints the...
-
Extension for Encoding and Decoding Strings in Base64 in Swift
Here is an extension to base 64 encode and decode strings in Swift (3) extension String { func fromBase64() - String? { guard let data = Data(base64Encoded: self) else { return nil } return...