Posts

Showing posts from October, 2017

DateTIme In PlayGround Using Swift

//: Playground - noun: a place where people can play import UIKit import XCPlayground XCPSetExecutionShouldContinueIndefinitely (continueIndefinitely: true ) var str = "Hello, playground" func hello() {     print ( "Hello, World" )        } hello () struct DateTimeSlot{     var date: String !     var timeSlot: NSArray !     var expanded: Bool !          init (date: String , timeSlot: NSArray ,expanded: Bool ){         self . date = date         self . timeSlot = timeSlot         self . expanded = expanded              }      } print ( "end class" ) let par0: String = "3" ; print ( par0 ) var innerArrayMsData: [ Any ] = [] innerArrayMsData . append ([ "user_id" : par0 ]) var ...

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:  Strin...

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/ ...