Skip to content

4d/ios-QMobileAPI

Repository files navigation

QMobileAPI

swift carthage

Network layer to communicate with 4D server rest API. Part of iOS SDK

Build

Using Xcode project

To download dependencies use carthage checkout

then open workspace with Xcode and compile

Using swift package manager

You can open Package.swift with Xcode and compile or launch standards command line for swift, see build.sh

How to

Initialize

Create your endpoint to make request

let url = URL(string: "http://your4dserverURL")!
let api = APIManager(url: url)

Make request

Server info

api.loadStatus { result in
   switch result {
      case .success(let info):
        print("\(status.ok)")
      case .failure(let error):
        print("\(error)")
   }
}
api.loadInfo { result in
  switch result {
     case .success(let info):
       ...
     case .failure(let error):
       print("\(error)")
  }
}

Table/Catalog

api.loadTables { result in
  switch result {
     case .success(let tables):
      for table in tables {
       ...
      }
     case .failure(let error):
       print("\(error)")
  }
}
api.loadTable(name: "ATable") { result in
  switch result {
     case .success(let table):
       ...
     case .failure(let error):
       print("\(error)")
  }
}
api.loadCatalog { result in
  switch result {
     case .success(let catalogs):
       for catalog in catalogs {
        ...
       }
     case .failure(let error):
       print("\(error)")
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages