martial-plains / worldtimeapi-swift

A Swift wrapper for http://worldtimeapi.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

World Time Wrapper

This is a simple wrapper for the World Time API. This crate is based on the WorldTimeAPI wrapper by Dulatr.

Installation

You can integrate AnsiStyle into your project using Swift Package Manager (SPM). Simply add it as a dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/martial-plains/worldtimeapi-rs.git", branch: "main")
]

Example

import WorldTimeAPI

@main
struct Main {
  static func main() async {
    do {
      let client = try await Client(endpoint: .timezone)
      let requests = ["area": "America", "location": "New_York"]

      // Returns DateTimeJson
      let response = try await client.get(payload: requests)

      print(response)

    } catch {
      print(error.localizedDescription)
    }

  }
}

About

A Swift wrapper for http://worldtimeapi.org

License:MIT License


Languages

Language:Swift 100.0%