Swiftpack.co - pawello2222/PhantomKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by pawello2222.
pawello2222/PhantomKit 1.0.2
All Swift & SwiftUI extensions and components in one place.
⭐️ 30
🕓 38 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/pawello2222/PhantomKit.git", from: "1.0.2")

PhantomKit logo

Build Code coverage Language Supported platforms

Swift Package Manager Release version License

PhantomKit

PhantomKit is a collection of many useful Swift and SwiftUI extensions and components. It is an invisible layer that supports your application and makes writing Swift code easier.

Table of Contents
  1. Installation
  2. Highlights
  3. License

Installation

Requirements

  • iOS 16.0+
  • macOS 13.0+
  • watchOS 9.0+
  • tvOS 16.0+

Swift Package Manager

PhantomKit is available as a Swift Package.

.package(url: "https://github.com/pawello2222/PhantomKit.git", .upToNextMajor(from: "1.0.0"))

Tip

To make PhantomKit truly invisible add the below line in the main file:

@_exported import PhantomKit

Highlights

Swift extensions

Appliable

let button = UIButton().apply {
    $0.isUserInteractionEnabled = false
}
UserDefaults.standard.apply {
    $0.set("Value 1", forKey: "Key 1")
    $0.set("Value 2", forKey: "Key 2")
    $0.set("Value 3", forKey: "Key 3")
}

Date

let date = Date(year: 2000, month: 1, day: 2, hour: 3, minute: 4, second: 5)

XCTAssertEqual(date.adjusting(\.second, by: 1).component(.second), 6)
XCTAssertEqual(date.adjusting(\.minute, by: 1).component(.minute), 5)
XCTAssertEqual(date.adjusting(\.hour, by: 1).component(.hour), 4)
XCTAssertEqual(date.adjusting(\.day, by: 1).component(.day), 3)
XCTAssertEqual(date.adjusting(\.month, by: 1).component(.month), 2)
XCTAssertEqual(date.adjusting(\.year, by: 1).component(.year), 2001)

SwiftUI extensions

Convenience methods

Text("PhantomKit")
    .fixedSize(.horizontal)
    .frame(max: .infinity)
    .onTap {
        print("PhantomKit tapped")
    }

Links

extension URL {
    static let home = URL(string: "https://tersacore.com")!
}
Text("Link")
    .link(url: .home, openedAs: .fullscreen)
Text("Link")
    .link(url: .home, openedAs: .external)

Presentation

Text("Open sheet view")
    .sheet {
        Text("Sheet view")
    }
Text("Open fullscreen view")
    .fullScreenCover {
        Text("Sheet view")
    }

View alignment

Text("PhantomKit")
    .alignment(horizontal: .trailing)

instead of:

HStack {
    Spacer()
    Text("PhantomKit")
}

License

PhantomKit is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 30
Last commit: 9 hours ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.2
38 weeks ago

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