Swiftpack.co - lawrencebensaid/SwiftHK as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by lawrencebensaid.
lawrencebensaid/SwiftHK v0.1
HomeKit for Swift is a package which allows you to interact with HomeKit in a modern way.
⭐️ 7
🕓 1 year ago
iOS macOS watchOS
.package(url: "https://github.com/lawrencebensaid/SwiftHK.git", from: "v0.1")

HomeKit for Swift (SwiftHK)

HomeKit for Swift is a package which allows you to interact with HomeKit in a modern way.

import SwiftHK


let home = Manager().home

// Print power status of all services
for service in home.services {
    let isOn = try await service.fetch(.powerState)
    print("\(service.name) is \(isOn == true ? "ON" : "OFF")")
}

// Switch everything off
for service in home.services {
    try await service.fetch(.powerState)
}

Example output:

Lightbulb L4MT is ON
Lightbulb 8D21 is OFF
Outlet P92E is ON

NOTE: This project is a WORK IN PROGRESS. It is unfinished subject to change!

GitHub

link
Stars: 7
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

HomeKit for Swift v0.1
1 year ago

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