Swiftpack.co - oe/SwiftKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by oe.
oe/SwiftKit 0.2.2
useful extensions for swift
⭐️ 0
🕓 3 weeks ago
iOS macOS
.package(url: "https://github.com/oe/SwiftKit.git", from: "0.2.2")

SwiftKit

A swift package for personal use(updating while my swift skills improving)

available for > macOS12 and > iOS15

Installation

click menu File -> Add Packages..., then input https://github.com/oe/SwiftKit

Features

URLSession in Javascript Fetch style

let resp = try await HTTPRequest.fetch("http://www.google.com/")
// with text encoding well handled
let html = resp.text()!


struct UserMeta: Decodable {
  var page: Int
  var per_page: Int
  var total: Int
  var total_pages: Int
}

let resp2 = try await HTTPRequest.fetch("https://reqres.in/api/users", .init(qs: ["page": "1", "per_page": "3"]))
let userMeta: UserMeta = try resp2.json()

Color

convert hex int to Color

let color = Color(hex: 0x123123)

GitHub

link
Stars: 0
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics