Posts

call API in Playground

go to file: go to new : goto playground: //: Playground - noun: a place where people can play import XCPlayground import UIKit XCPSetExecutionShouldContinueIndefinitely (continueIndefinitely: true ) var str = "Hello, playground" func hello() {     print ( "Hello, World" ) } hello () class Location: NSObject {     var id: String     var name: String     init (id : String , name: String ){         self . id = id         self . name = name     }      } var fetchedLocation = [ Location ]() // var myArray: NSArray! = [] var cart: [[ String : Any ]] = [] var arrobj: [[ String : Any ]] = [] func location(){ let par: String = "A" ; cart . append ([ "keyword" : par]) arrobj . insert ([ "keyword" : par], at: 0 ) //print(arrobj) //------------ form data --------- fetche...

Exploring OneMap REST API in Swift Playgrounds

Image
I had posted how to add OneMap into your iOS application in  previous post . In this tutorial we will try one of the OneMap REST APIs in Swift Playgrounds and see the return results. Xcode Playgrounds is perfect for experimenting with new APIs interactively. We are going to use Address Search API from OneMap. This allows searching of address data for a given search value.  This also allows support of commands such as AND, OR, including word (+), excluding word (-), and exact phrase search using quotation marks. It will return search results with X,Y coordinates of the searched location.   http://www.onemap.sg/api/help/ First create a new Playgrounds file in xcode. Then import XCPlayground module. After that call XCPSetExecutionShouldContinueIndefinitely and set it true so that execution will continue and we can see the return result from asynchronous REST API calls. https://zkkmin.com/2015/04/22/exploring-onemap-rest-api-in-swift-playgrounds/ ...