Swiftpack.co - Swift Packages by 0xOpenBytes

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Packages published by 0xOpenBytes

0xOpenBytes/TaskManager 1.0.1
A cache for asynchronous tasks in Swift
⭐️ 10
πŸ•“ 41 weeks ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
1.0.1
41 weeks ago
- Update Cache to 2.0.0 **Full Changelog**: https://github.com/0xOpenBytes/TaskManager/compare/1.0.0...1.0.1
1.0.0
41 weeks ago
# TaskManager `TaskManager` is a cache for asynchronous tasks in Swift. It allows you to manage the execution of tasks with a simple API that lets you add, cancel, and wait for tasks. ## Usage ### Creating a TaskManager To create a `TaskManager`, simply instantiate it with a key type that conforms to `Hashable`. It is recommended to use an enum as the key type to avoid typos and ensure type safety: ```swift enum TaskKey: Hashable { case fetchUserData(userId: String) case downloadFile(url: URL) } let taskManager = TaskManager<TaskKey>() ``` ### Adding a Task To add a new task to the `TaskManager`, use the `task(key:priority:operation:)` method. The `key` parameter is the unique identifier for the task, `priority` is the priority of the task (optional), and `operation` is the async operation to be performed: ```swift taskManager.task(key: .fetchUserData(userId: "1234"), priority: .high) { // Perform async operation to fetch user data return userData } ``` ### Retrieving a Task Result To retrieve the result of a task, use the `value(for:as:)` method. The `for` parameter is the key of the task, and `as` is the type of the result you expect to receive: ```swift let userData = try await taskManager.value(for: .fetchUserData(userId: "1234"), as: UserData.self) ``` or ```swift let userData: UserData = try await taskManager.value(for: .fetchUserData(userId: "1234")) ``` ### Canceling a Task To cancel a task, use the `cancel(key:)` method: ```swift taskManager.cancel(key: .fetchUserData(userId: "1234")) ``` ### Canceling All Tasks To cancel all tasks, use the `cancelAll()` method: ```swift taskManager.cancelAll() ``` *** **Full Changelog**: https://github.com/0xOpenBytes/TaskManager/compare/0.1.0...1.0.0
0.1.0
1 year ago
# TaskManager `TaskManager` is a cache for asynchronous tasks in Swift. It allows you to manage the execution of tasks with a simple API that lets you add, cancel, and wait for tasks. ## Usage ### Creating a TaskManager To create a `TaskManager`, simply instantiate it with a key type that conforms to `Hashable`. It is recommended to use an enum as the key type to avoid typos and ensure type safety: ```swift enum TaskKey: Hashable { case fetchUserData(userId: String) case downloadFile(url: URL) } let taskManager = TaskManager<TaskKey>() ``` ### Adding a Task To add a new task to the `TaskManager`, use the `task(key:priority:operation:)` method. The `key` parameter is the unique identifier for the task, `priority` is the priority of the task (optional), and `operation` is the async operation to be performed: ```swift taskManager.task(key: .fetchUserData(userId: "1234"), priority: .high) { // Perform async operation to fetch user data return userData } ``` ### Retrieving a Task Result To retrieve the result of a task, use the `value(for:as:)` method. The `for` parameter is the key of the task, and `as` is the type of the result you expect to receive: ```swift let userData = try await taskManager.value(for: .fetchUserData(userId: "1234"), as: UserData.self) ``` or ```swift let userData: UserData = try await taskManager.value(for: .fetchUserData(userId: "1234")) ``` ### Canceling a Task To cancel a task, use the `cancel(key:)` method: ```swift taskManager.cancel(key: .fetchUserData(userId: "1234")) ``` ### Canceling All Tasks To cancel all tasks, use the `cancelAll()` method: ```swift taskManager.cancelAll() ``` *** **Full Changelog**: https://github.com/0xOpenBytes/TaskManager/commits/0.1.0
iOS macOS watchOS tvOS
0xOpenBytes/o 2.1.1
Output and Input for File, URL, and Console
⭐️ 8
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
2.1.1
1 year ago
## What's Changed * Readme Changes by @haIIux in https://github.com/0xOpenBytes/o/pull/8 * Remove tvOS Notifications by @0xLeif in https://github.com/0xOpenBytes/o/pull/9 ## New Contributors * @haIIux made their first contribution in https://github.com/0xOpenBytes/o/pull/8 **Full Changelog**: https://github.com/0xOpenBytes/o/compare/2.1.0...2.1.1
2.1.0
1 year ago
## What's Changed * Improve usage with non JSON functions. Added String and Data functions for in and out. by @0xLeif in https://github.com/0xOpenBytes/o/pull/7 **Full Changelog**: https://github.com/0xOpenBytes/o/compare/2.0.0...2.1.0
2.0.0
1 year ago
## What's Changed * Improve o.file using paths by @0xLeif in https://github.com/0xOpenBytes/o/pull/6 **Full Changelog**: https://github.com/0xOpenBytes/o/compare/1.0.1...2.0.0
1.0.1
1 year ago
## What's Changed * Lower platform OS versions by @0xLeif in https://github.com/0xOpenBytes/o/pull/5 **Full Changelog**: https://github.com/0xOpenBytes/o/compare/1.0.0...1.0.1
1.0.0
1 year ago
# o *Output and Input* ## What is `o`? `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. ## Where can `o` be used? Currently, `o` can be used on macOS, iOS, and watchOS. ## Examples ### o.console ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` ### o.file ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` ### o.url ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request let (data, response) = try await o.url.get( url: URL(string: "api/posts")! ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") let (_, response) = try await o.url.post( url: URL(string: "api/posts/\(post.id)")!, body: try? JSONEncoder().encode(post) ) print(response) ``` ### o.notification ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ``` *** ## What's Changed * Leif/feature/data response by @0xLeif in https://github.com/0xOpenBytes/o/pull/3 * Create CI.yml by @0xLeif in https://github.com/0xOpenBytes/o/pull/4 **Full Changelog**: https://github.com/0xOpenBytes/o/compare/0.3.0...1.0.0
0.3.0
1 year ago
## What's Changed * Prefer full async solution to URL. by @0xLeif in https://github.com/0xOpenBytes/o/pull/2 ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request let (data, response) = try await o.url.get( url: URL(string: "api/posts")! ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") let (_, response) = try await o.url.post( url: URL(string: "api/posts/\(post.id)")!, body: try? JSONEncoder().encode(post) ) print(response) ``` **Full Changelog**: https://github.com/0xOpenBytes/o/compare/0.2.1...0.3.0
0.2.1
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/o/compare/0.2.0...0.2.1 # o *Output and Input* ## What is `o`? `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. ## Where can `o` be used? Currently, `o` can be used on macOS, iOS, and watchOS. ## Examples ### o.console ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` ### o.file ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` ### o.url ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` ### o.notification ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ```
0.2.0
2 years ago
- [Add url case when Value is Data](https://github.com/0xOpenBytes/o/commit/760c971650413d30c2edba6090fd92ce0720b8a0) @0xLeif **Full Changelog**: https://github.com/0xOpenBytes/o/compare/0.1.0...0.2.0 # o *Output and Input* ## What is `o`? `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. ## Where can `o` be used? Currently, `o` can be used on macOS, iOS, and watchOS. ## Examples ### o.console ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` ### o.file ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` ### o.url ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` ### o.notification ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ```
0.1.0
2 years ago
# o *Output and Input* ## What is `o`? `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. ## Where can `o` be used? Currently, `o` can be used on macOS, iOS, and watchOS. ## Examples ### o.console ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` ### o.file ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` ### o.url ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` ### o.notification ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ```
iOS macOS watchOS tvOS
0xOpenBytes/c 4.0.0
πŸ“¦ Micro Composition using Transformations and Cache
⭐️ 6
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
4.0.0
1 year ago
## What's Changed * Readme Changes by @haIIux in https://github.com/0xOpenBytes/c/pull/9 * Add Value for Cache by @0xLeif in https://github.com/0xOpenBytes/c/pull/10 * Leif/keyed value cache by @0xLeif in https://github.com/0xOpenBytes/c/pull/11 ## New Contributors * @haIIux made their first contribution in https://github.com/0xOpenBytes/c/pull/9 **Full Changelog**: https://github.com/0xOpenBytes/c/compare/3.0.2...4.0.0
3.0.2
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/c/compare/3.0.1...3.0.2
3.0.1
1 year ago
## What's Changed * Update t to 1.0.0 by @0xLeif in https://github.com/0xOpenBytes/c/pull/8 **Full Changelog**: https://github.com/0xOpenBytes/c/compare/3.0.0...3.0.1
3.0.0
1 year ago
## What's Changed - Added InvalidTypeError - Removed force unwraps for throwing - Changed JSON to a struct and removed conformance to Cacheable **Full Changelog**: https://github.com/0xOpenBytes/c/compare/2.0.0...3.0.0
2.0.0
1 year ago
# c *Micro Composition* ## What is `c`? `c` is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved. ## Where can `c` be used? `c` can be used anywhere to create transformations or interact with the cache. ## Examples ### BiDirectionalTransformation of String and Int ```swift let transformer = c.transformer( from: { string in Int(string) }, to: { int in "\(String(describing: int))" } ) let string = transformer.to(3) let int = transformer.from("3") try t.assert(transformer.to(int), isEqualTo: string) ``` ### Cache ```swift let cache = c.Cache() cache.set(value: Double.pi, forKey: "πŸ₯§") let pi: Double = cache.get("πŸ₯§") ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = try cache.resolve("πŸ₯§") try t.assert(resolvedValue, isEqualTo: .pi) cache.remove("πŸ₯§") let nilValue: Double? = cache.get("πŸ₯§") try t.assert(isNil: nilValue) ``` ### KeyedCache ```swift enum CacheKey: Hashable { ... } let cache = c.KeyedCache<CacheKey>() cache.set(value: Double.pi, forKey: CacheKey.piKey) let pi: Double = cache.get(.piKey) ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = try cache.resolve(.piKey) try t.assert(resolvedValue, isEqualTo: .pi) cache.remove(.piKey) let nilValue: Double? = cache.get(.piKey) try t.assert(isNil: nilValue) ``` ### JSON ```swift enum MockJSONKey: String, Hashable { case name, number, bool, invalid_key } struct MockJSON: Codable { var name: String var number: Int var bool: Bool } let jsonData: Data = try! JSONEncoder().encode(MockJSON(name: "Twitch", number: 5, bool: false)) let json: c.JSON<MockJSONKey> = .init(data: jsonData) XCTAssertEqual(try! json.resolve(.name), "Twitch") XCTAssertEqual(try! json.resolve(.number), 5) XCTAssertEqual(try! json.resolve(.bool), false) let invalid_key: Bool? = json.get(.invalid_key) XCTAssertNil(json.get(.invalid_key)) XCTAssertNil(invalid_key) json.set(value: "Leif", forKey: .name) XCTAssertEqual(try! json.resolve(.name), "Leif") ``` ### Global Cache ```swift let someCache: Cache = ... // Set the value of a Cache with any hashable key c.set(value: someCache, forKey: "someCache") // Get an optional Cache using any hashable key let anotherCache: Cache? = c.get(0) // Require that a Cache exist using a `.get` with a force unwrap let requiredCache: Cache = try c.resolve(0) let keyedCache: KeyedCache<String> = try c.resolve(...) ``` *** ### **Changes**: https://github.com/0xOpenBytes/c/commit/1a211c68ce509f77f789440ba008e7ad2898dac1
1.2.0
1 year ago
## What's Changed * Support sub JSON Arrays by @0xLeif in https://github.com/0xOpenBytes/c/pull/6 **Full Changelog**: https://github.com/0xOpenBytes/c/compare/1.1.1...1.2.0
1.1.1
1 year ago
## Fixed - Access type for MissingRequiredKeysError init ## Added - contains: Checks if the given `key` has a value or not - require: Checks to make sure the cache has the required keys, otherwise it will throw an error - valuesInCache: Returns a Dictionary containing only the key value pairs where the value is the same type as the generic type `Value` ## What's Changed * Develop by @0xLeif in https://github.com/0xOpenBytes/c/pull/5 **Full Changelog**: https://github.com/0xOpenBytes/c/compare/1.1.0...1.1.1
1.1.0
1 year ago
## Added - contains: Checks if the given `key` has a value or not - require: Checks to make sure the cache has the required keys, otherwise it will throw an error - valuesInCache: Returns a Dictionary containing only the key value pairs where the value is the same type as the generic type `Value` ## What's Changed * Develop by @0xLeif in https://github.com/0xOpenBytes/c/pull/5 **Full Changelog**: https://github.com/0xOpenBytes/c/compare/1.0.1...1.1.0
1.0.1
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/c/compare/1.0.0...1.0.1
1.0.0
1 year ago
# c *Micro Composition* ## What is `c`? `c` is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved. ## Where can `c` be used? `c` can be used anywhere to create transformations or interact with the cache. ## Examples ### BiDirectionalTransformation of String and Int ```swift let transformer = c.transformer( from: { string in Int(string) }, to: { int in "\(String(describing: int))" } ) let string = transformer.to(3) let int = transformer.from("3") try t.assert(transformer.to(int), isEqualTo: string) ``` ### Cache ```swift let cache = c.Cache() cache.set(value: Double.pi, forKey: "πŸ₯§") let pi: Double = cache.get("πŸ₯§") ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve("πŸ₯§") try t.assert(resolvedValue, isEqualTo: .pi) cache.remove("πŸ₯§") let nilValue: Double? = cache.get("πŸ₯§") try t.assert(isNil: nilValue) ``` ### KeyedCache ```swift enum CacheKey: Hashable { ... } let cache = c.KeyedCache<CacheKey>() cache.set(value: Double.pi, forKey: CacheKey.piKey) let pi: Double = cache.get(.piKey) ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve(.piKey) try t.assert(resolvedValue, isEqualTo: .pi) cache.remove(.piKey) let nilValue: Double? = cache.get(.piKey) try t.assert(isNil: nilValue) ``` ### JSON ```swift enum MockJSONKey: String, Hashable { case name, number, bool, invalid_key } struct MockJSON: Codable { var name: String var number: Int var bool: Bool } let jsonData: Data = try! JSONEncoder().encode(MockJSON(name: "Twitch", number: 5, bool: false)) let json: c.JSON<MockJSONKey> = .init(data: jsonData) XCTAssertEqual(json.resolve(.name), "Twitch") XCTAssertEqual(json.resolve(.number), 5) XCTAssertEqual(json.resolve(.bool), false) let invalid_key: Bool? = json.get(.invalid_key) XCTAssertNil(json.get(.invalid_key)) XCTAssertNil(invalid_key) json.set(value: "Leif", forKey: .name) XCTAssertEqual(json.resolve(.name), "Leif" ``` ### Global Cache ```swift let someCache: Cache = ... // Set the value of a Cache with any hashable key c.set(value: someCache, forKey: "someCache") // Get an optional Cache using any hashable key let anotherCache: Cache? = c.get(0) // Require that a Cache exist using a `.get` with a force unwrap let requiredCache: Cache = c.resolve(0) let keyedCache: KeyedCache<String> = c.resolve(...) ``` **Full Changelog**: https://github.com/0xOpenBytes/c/compare/0.4.0...1.0.0
iOS macOS watchOS tvOS
0xOpenBytes/t 1.0.4
πŸ§ͺ Quickly test expectations
⭐️ 6
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
1.0.4
1 year ago
## What's Changed * Correctly pass error to suite and expect by @0xLeif in https://github.com/0xOpenBytes/t/pull/4 **Full Changelog**: https://github.com/0xOpenBytes/t/compare/1.0.3...1.0.4
1.0.3
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/t/compare/1.0.2...1.0.3
1.0.2
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/t/compare/1.0.1...1.0.2
1.0.1
1 year ago
## What's Changed * Update supported platforms by @0xLeif in https://github.com/0xOpenBytes/t/pull/3 **Full Changelog**: https://github.com/0xOpenBytes/t/compare/1.0.0...1.0.1
1.0.0
1 year ago
# t *Quickly test expectations* ## What is `t`? `t` is a simple testing framework using closures and errors. You have the ability to create a `suite` that has multiple steps, expectations, and asserts. Expectations can be used to `expect` one or multiple assertions. ## Where can `t` be used? `t` can be used to test quickly inside a function to make sure something is working as expected. `t` can also be used in unit tests if wanted. ## Examples ### t.suite ```swift t.suite { // Add an expectation that asserting true is true and that 2 is equal to 2 try t.expect { try t.assert(true) try t.assert(2, isEqualTo: 2) } // Add an assertion that asserting false is not true try t.assert(notTrue: false) // Add an assertion that "Hello" is not equal to "World" try t.assert("Hello", isNotEqualTo: "World") // Log a message t.log("πŸ“£ Test Log Message") // Log a t.error t.log(error: t.error(description: "Mock Error")) // Log any error struct SomeError: Error { } t.log(error: SomeError()) // Add an assertion to check if a value is nil let someValue: String? = nil try t.assert(isNil: someValue) // Add an assertion to check if a value is not nil let someOtherValue: String? = "πŸ’ " try t.assert(isNotNil: someOtherValue) } ``` ### t.expect ```swift try t.expect { let someValue: String? = "Hello" try t.assert(isNil: someValue) } ``` ### t.assert ```swift try t.assert("Hello", isEqualTo: "World") ``` ### t.log ```swift t.log("πŸ“£ Test Log Message") ``` ### XCTest #### Assert suite is true ```swift XCTAssert( t.suite { try t.assert(true) } ) ``` #### Assert expectation is true ```swift XCTAssertNoThrow( try t.expect("true is true and that 2 is equal to 2") { try t.assert(true) try t.assert(2, isEqualTo: 2) } ) ``` #### Assert is false ```swift XCTAssertThrowsError( try t.assert(false) ) ``` *** ## What's Changed * Add Swift async support and unwrap and throwing functions by @0xLeif in https://github.com/0xOpenBytes/t/pull/2 **Full Changelog**: https://github.com/0xOpenBytes/t/compare/0.2.0...1.0.0
0.2.0
2 years ago
# What's Changed ## Updated - `tError` renamed `TestError` - `TestError` is now public - Regenerated Documentation ## Added - Overridable Emojis to be used when logging - tested<Output> - async **Full Changelog**: https://github.com/0xOpenBytes/t/compare/0.1.0...0.2.0
0.1.0
2 years ago
# t *Quickly test expectations* ## What is `t`? `t` is a simple testing framework using closures and errors. You have the ability to create a `suite` that has multiple steps, expectations, and asserts. Expectations can be used to `expect` one or multiple assertions. ## Where can `t` be used? `t` can be used to test quickly inside a function to make sure something is working as expected. `t` can also be used in unit test if wanted. ## Examples ### t.suite ```swift t.suite { // Add an expectation that asserting true is true and that 2 is equal to 2 try t.expect { try t.assert(true) try t.assert(2, isEqualTo: 2) } // Add an assertion that asserting false is not true try t.assert(notTrue: false) // Add an assertion that "Hello" is not equal to "World" try t.assert("Hello", isNotEqualTo: "World") // Log a message t.log("πŸ“£ Test Log Message") // Log a t.error t.log(error: t.error(description: "Mock Error")) // Log any error struct SomeError: Error { } t.log(error: SomeError()) // Add an assertion to check if a value is nil let someValue: String? = nil try t.assert(isNil: someValue) // Add an assertion to check if a value is not nil let someOtherValue: String? = "πŸ’ " try t.assert(isNotNil: someOtherValue) } ``` ### t.expect ```swift try t.expect { let someValue: String? = "Hello" try t.assert(isNil: someValue) } ``` ### t.assert ```swift try t.assert("Hello", isEqualTo: "World") ``` ### t.log ```swift t.log("πŸ“£ Test Log Message") ``` ### XCTest #### Assert suite is true ```swift XCTAssert( t.suite { try t.assert(true) } ) ``` #### Assert expectation is true ```swift XCTAssertNoThrow( try t.expect("true is true and that 2 is equal to 2") { try t.assert(true) try t.assert(2, isEqualTo: 2) } ) ``` #### Assert is false ```swift XCTAssertThrowsError( try t.assert(false) ) ```
iOS macOS watchOS tvOS
0xOpenBytes/CacheStore 4.0.0
🌳 SwiftUI State Management
⭐️ 5
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
4.0.0
1 year ago
## What's Changed - Removed any force casting, breaking change - Give more valuable information using errors - Resolved memory leaks - Optimize the little things ### PRs * Create tests.yml by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/24 * V4.0.0 by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/25 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.3.0...4.0.0
3.3.0
1 year ago
## What's Changed * Promote a better SwiftUI objectWillChange and sink to the CacheStore publisher by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/23 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.2.2...3.3.0
3.2.2
1 year ago
## What's Changed * Update equating CacheStores by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/21 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.2.1...3.2.2
3.2.1
1 year ago
## What's Changed * Support Task cancellation by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/20 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.2.0...3.2.1
3.2.0
1 year ago
## What's Changed * Feature/open access by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/19 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.1.0...3.2.0
StoreView and StoreContent
1 year ago
## What's Changed * Feature/store content by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/17 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.0.4...3.1.0
3.0.4
1 year ago
## What's Changed * Feature/collection equal by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/16 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.0.3...3.0.4
3.0.3
1 year ago
## What's Changed * Bug/fix dict test store by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/15 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.0.2...3.0.3
3.0.2
1 year ago
## What's Changed * Use XCTFail from XCTestDynamicOverlay as default handler by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/14 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.0.1...3.0.2
3.0.1
1 year ago
## What's Changed * Remove if debug for locking by @0xLeif in https://github.com/0xOpenBytes/CacheStore/pull/13 **Full Changelog**: https://github.com/0xOpenBytes/CacheStore/compare/3.0.0...3.0.1
iOS macOS watchOS
0xOpenBytes/FLet 2.0.0
Micro Framework Collection
⭐️ 5
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
2.0.0
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/FLet/compare/1.1.0...2.0.0
1.1.0
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/FLet/compare/1.0.1...1.1.0 # FLet *A collection of micro frameworks* ## Frameworks - [t (FLet.testing)](https://github.com/0xOpenBytes/t): πŸ§ͺ Quickly test expectations - `t` is a simple testing framework using closures and errors. You have the ability to create a `suite` that has multiple steps, expectations, and asserts. Expectations can be used to `expect` one or multiple assertions. `t` can be used to test quickly inside a function to make sure something is working as expected. `t` can also be used in unit test if wanted. - [c (FLet.composition)](https://github.com/0xOpenBytes/c): πŸ“¦ Micro Composition using Transformations and Cache - `c` is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved. `c` can be used anywhere to create transformations or interact with the cache. - [o (FLet.transput)](https://github.com/0xOpenBytes/o): Output and Input for File, URL, and Console - `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. Currently, `o` can be used on macOS, iOS, and watchOS. ## Usage ### Testing <details> <summary>Suite</summary> ```swift t.suite { // Add an expectation that asserting true is true and that 2 is equal to 2 try t.expect { try t.assert(true) try t.assert(2, isEqualTo: 2) } // Add an assertion that asserting false is not true try t.assert(notTrue: false) // Add an assertion that "Hello" is not equal to "World" try t.assert("Hello", isNotEqualTo: "World") // Log a message t.log("πŸ“£ Test Log Message") // Log a t.error t.log(error: t.error(description: "Mock Error")) // Log any error struct SomeError: Error { } t.log(error: SomeError()) // Add an assertion to check if a value is nil let someValue: String? = nil try t.assert(isNil: someValue) // Add an assertion to check if a value is not nil let someOtherValue: String? = "πŸ’ " try t.assert(isNotNil: someOtherValue) } ``` </details> <details> <summary>Expect</summary> ```swift try t.expect { let someValue: String? = "Hello" try t.assert(isNil: someValue) } ``` </details> <details> <summary>Assert</summary> ```swift try t.assert("Hello", isEqualTo: "World") ``` </details> <details> <summary>Logging</summary> ```swift t.log("πŸ“£ Test Log Message") ``` </details> <details> <summary>XCTest</summary> ```swift // Assert suite is true XCTAssert( t.suite { try t.assert(true) } ) // Assert expectation is true XCTAssertNoThrow( try t.expect("true is true and that 2 is equal to 2") { try t.assert(true) try t.assert(2, isEqualTo: 2) } ) // Assert is false XCTAssertThrowsError( try t.assert(false) ) ``` </details> ### Composition <details> <summary>Local Cache</summary> ### Cache ```swift let cache = c.Cache() cache.set(value: Double.pi, forKey: "πŸ₯§") let pi: Double = cache.get("πŸ₯§") ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve("πŸ₯§") try t.assert(resolvedValue, isEqualTo: .pi) ``` ### KeyedCache ```swift enum CacheKey: Hashable { ... } let cache = c.KeyedCache<CacheKey>() cache.set(value: Double.pi, forKey: CacheKey.piKey) let pi: Double = cache.get(.piKey) ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve(.piKey) try t.assert(resolvedValue, isEqualTo: .pi) ``` </details> <details> <summary>Global Cache</summary> ```swift let someCache: Cache = ... // Set the value of a Cache with any hashable key c.set(value: someCache, forKey: "someCache") // Get an optional Cache using any hashable key let anotherCache: Cache? = c.get(0) // Require that a Cache exist using a `.get` with a force unwrap let requiredCache: Cache = c.resolve(0) ``` </details> <details> <summary>Transformation</summary> ```swift let transformer = c.transformer( from: { string in Int(string) }, to: { int in "\(String(describing: int))" } ) let string = transformer.to(3) let int = transformer.from("3") try t.assert(transformer.to(int), isEqualTo: string) ``` </details> ### Transput <details> <summary>Console</summary> ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` </details> <details> <summary>File</summary> ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` </details> <details> <summary>URL</summary> ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` </details> <details> <summary>Notification</summary> ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ``` </details> ### Shorthand Typealias ```swift public typealias __ = FLet ```
1.0.1
1 year ago
**Full Changelog**: https://github.com/0xOpenBytes/FLet/compare/1.0.0...1.0.1 # FLet *A collection of micro frameworks* ## Frameworks - [t (FLet.testing)](https://github.com/0xOpenBytes/t): πŸ§ͺ Quickly test expectations - `t` is a simple testing framework using closures and errors. You have the ability to create a `suite` that has multiple steps, expectations, and asserts. Expectations can be used to `expect` one or multiple assertions. `t` can be used to test quickly inside a function to make sure something is working as expected. `t` can also be used in unit test if wanted. - [c (FLet.composition)](https://github.com/0xOpenBytes/c): πŸ“¦ Micro Composition using Transformations and Cache - `c` is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved. `c` can be used anywhere to create transformations or interact with the cache. - [o (FLet.transput)](https://github.com/0xOpenBytes/o): Output and Input for File, URL, and Console - `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. Currently, `o` can be used on macOS, iOS, and watchOS. ## Usage ### Testing <details> <summary>Suite</summary> ```swift t.suite { // Add an expectation that asserting true is true and that 2 is equal to 2 try t.expect { try t.assert(true) try t.assert(2, isEqualTo: 2) } // Add an assertion that asserting false is not true try t.assert(notTrue: false) // Add an assertion that "Hello" is not equal to "World" try t.assert("Hello", isNotEqualTo: "World") // Log a message t.log("πŸ“£ Test Log Message") // Log a t.error t.log(error: t.error(description: "Mock Error")) // Log any error struct SomeError: Error { } t.log(error: SomeError()) // Add an assertion to check if a value is nil let someValue: String? = nil try t.assert(isNil: someValue) // Add an assertion to check if a value is not nil let someOtherValue: String? = "πŸ’ " try t.assert(isNotNil: someOtherValue) } ``` </details> <details> <summary>Expect</summary> ```swift try t.expect { let someValue: String? = "Hello" try t.assert(isNil: someValue) } ``` </details> <details> <summary>Assert</summary> ```swift try t.assert("Hello", isEqualTo: "World") ``` </details> <details> <summary>Logging</summary> ```swift t.log("πŸ“£ Test Log Message") ``` </details> <details> <summary>XCTest</summary> ```swift // Assert suite is true XCTAssert( t.suite { try t.assert(true) } ) // Assert expectation is true XCTAssertNoThrow( try t.expect("true is true and that 2 is equal to 2") { try t.assert(true) try t.assert(2, isEqualTo: 2) } ) // Assert is false XCTAssertThrowsError( try t.assert(false) ) ``` </details> ### Composition <details> <summary>Local Cache</summary> ```swift let cache = c.cache() cache.set(value: Double.pi, forKey: "πŸ₯§") let pi: Double = cache.get("πŸ₯§") ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve("πŸ₯§") try t.assert(resolvedValue, isEqualTo: .pi) ``` </details> <details> <summary>Global Cache</summary> ```swift let someCache: Cache = ... // Set the value of a Cache with any hashable key c.set(value: someCache, forKey: "someCache") // Get an optional Cache using any hashable key let anotherCache: Cache? = c.get(0) // Require that a Cache exist using a `.get` with a force unwrap let requiredCache: Cache = c.resolve(0) ``` </details> <details> <summary>Transformation</summary> ```swift let transformer = c.transformer( from: { string in Int(string) }, to: { int in "\(String(describing: int))" } ) let string = transformer.to(3) let int = transformer.from("3") try t.assert(transformer.to(int), isEqualTo: string) ``` </details> ### Transput <details> <summary>Console</summary> ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` </details> <details> <summary>File</summary> ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` </details> <details> <summary>URL</summary> ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` </details> <details> <summary>Notification</summary> ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ``` </details> ### Shorthand Typealias ```swift public typealias __ = FLet ```
1.0.0
2 years ago
# FLet *A collection of micro frameworks* ## Frameworks - [t (FLet.testing)](https://github.com/0xOpenBytes/t): πŸ§ͺ Quickly test expectations - `t` is a simple testing framework using closures and errors. You have the ability to create a `suite` that has multiple steps, expectations, and asserts. Expectations can be used to `expect` one or multiple assertions. `t` can be used to test quickly inside a function to make sure something is working as expected. `t` can also be used in unit test if wanted. - [c (FLet.composition)](https://github.com/0xOpenBytes/c): πŸ“¦ Micro Composition using Transformations and Cache - `c` is a simple composition framework. You have the ability to create transformations that are either unidirectional or bidirectional. There is also a cache that values can be set and resolved. `c` can be used anywhere to create transformations or interact with the cache. - [o (FLet.transput)](https://github.com/0xOpenBytes/o): Output and Input for File, URL, and Console - `o` is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. `o` can also get input from a file, url, or console. Currently, `o` can be used on macOS, iOS, and watchOS. ## Usage ### Testing <details> <summary>Suite</summary> ```swift t.suite { // Add an expectation that asserting true is true and that 2 is equal to 2 try t.expect { try t.assert(true) try t.assert(2, isEqualTo: 2) } // Add an assertion that asserting false is not true try t.assert(notTrue: false) // Add an assertion that "Hello" is not equal to "World" try t.assert("Hello", isNotEqualTo: "World") // Log a message t.log("πŸ“£ Test Log Message") // Log a t.error t.log(error: t.error(description: "Mock Error")) // Log any error struct SomeError: Error { } t.log(error: SomeError()) // Add an assertion to check if a value is nil let someValue: String? = nil try t.assert(isNil: someValue) // Add an assertion to check if a value is not nil let someOtherValue: String? = "πŸ’ " try t.assert(isNotNil: someOtherValue) } ``` </details> <details> <summary>Expect</summary> ```swift try t.expect { let someValue: String? = "Hello" try t.assert(isNil: someValue) } ``` </details> <details> <summary>Assert</summary> ```swift try t.assert("Hello", isEqualTo: "World") ``` </details> <details> <summary>Logging</summary> ```swift t.log("πŸ“£ Test Log Message") ``` </details> <details> <summary>XCTest</summary> ```swift // Assert suite is true XCTAssert( t.suite { try t.assert(true) } ) // Assert expectation is true XCTAssertNoThrow( try t.expect("true is true and that 2 is equal to 2") { try t.assert(true) try t.assert(2, isEqualTo: 2) } ) // Assert is false XCTAssertThrowsError( try t.assert(false) ) ``` </details> ### Composition <details> <summary>Local Cache</summary> ```swift let cache = c.cache() cache.set(value: Double.pi, forKey: "πŸ₯§") let pi: Double = cache.get("πŸ₯§") ?? 0 try t.assert(pi, isEqualTo: .pi) let resolvedValue: Double = cache.resolve("πŸ₯§") try t.assert(resolvedValue, isEqualTo: .pi) ``` </details> <details> <summary>Global Cache</summary> ```swift let someCache: Cache = ... // Set the value of a Cache with any hashable key c.set(value: someCache, forKey: "someCache") // Get an optional Cache using any hashable key let anotherCache: Cache? = c.get(0) // Require that a Cache exist using a `.get` with a force unwrap let requiredCache: Cache = c.resolve(0) ``` </details> <details> <summary>Transformation</summary> ```swift let transformer = c.transformer( from: { string in Int(string) }, to: { int in "\(String(describing: int))" } ) let string = transformer.to(3) let int = transformer.from("3") try t.assert(transformer.to(int), isEqualTo: string) ``` </details> ### Transput <details> <summary>Console</summary> ```swift o.console.out("Value to print: ", terminator: "") // (oTests/oTests.swift@7) [testExample()]: Value to print: o.console.out(o.console.in()) // Type in "???"; (oTests/oTests.swift@8) [testExample()]: Optional("???") ``` </details> <details> <summary>File</summary> ```swift let filename: String = ... // Write the value 4, an Int, to the file named `filename`. Files using o.file are base64Encoded. try o.file.out(4, filename: filename) // Asserts XCTAssertNoThrow(try o.file.in(filename: filename) as Int) XCTAssertEqual(try? o.file.in(filename: filename), 4) // Delete the File try o.file.delete(filename: filename) // Assert deletion XCTAssertThrowsError(try o.file.in(filename: filename) as Int) ``` </details> <details> <summary>URL</summary> ```swift struct Post: Codable { let userId: Int let id: Int let title: String let body: String } // GET Request o.url.in( url: URL(string: "api/posts")!, successHandler: { (posts: [Post], response) in print(posts) } ) // POST Request let post = Post(userId: 1, id: 1, title: "First!", body: "") try o.url.out( url: URL(string: "api/posts/\(post.id)")!, value: post, successHandler: { data, response in print(response) } ) ``` </details> <details> <summary>Notification</summary> ```swift // Request Notification Authorization o.notification.requestAuthorization() // Set UNUserNotificationCenter.current's delegate to `o.notification.delegate` o.notification.registerDelegate() // Schedule a Notification o.notification.post( title: "Hello!", subtitle: "o.notification", body: "Woo Hoo!", trigger: UNTimeIntervalNotificationTrigger( timeInterval: 3, repeats: false ) ) ``` </details> ### Shorthand Typealias ```swift public typealias __ = FLet ```
iOS macOS watchOS
0xOpenBytes/SDMarkdown 1.0.0
Convert ScreenData into Markdown
⭐️ 3
πŸ•“ 2 years ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
1.0.0
2 years ago
# SDMarkdown *Convert ScreenData into Markdown* *** ```swift let readme = SomeScreen( title: "SDMarkdown", someView: .vstack( [ .label(title: "Convert ScreenData into Markdown", font: .footnote) ] ) ) print(readme.markdown) ``` [source](https://github.com/0xOpenBytes/SDMarkdown/blob/1.0.0/Tests/SDMarkdownTests/SDMarkdownTests.swift)
0xOpenBytes/Planar 0.1.0
πŸ‘Ύ Build 2D games and simulations in Swift using SpriteKit
⭐️ 3
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.1.0
1 year ago
# Planar Planar is a library for building 2D games and simulations in Swift using SpriteKit. It provides a set of abstractions and utilities for organizing game objects, managing tasks, and handling input events. ## Usage To use Planar, simply create a new scene and inherit from `PlanarScene`: ```swift class GameScene: PlanarScene<GameSceneNodeKey> { // ... } ``` Next, define a set of unique node keys using an enum: ```swift enum GameSceneNodeKey: Hashable { case player(UInt) case enemy(UInt) case powerUp } ``` You can then add nodes to the scene using the `add(node:forKey:)` method, passing in a key that matches one of your defined keys: ```swift add(node: playerNode, forKey: .player(0)) add(node: enemyNode, forKey: .enemy(0)) add(node: powerUpNode, forKey: .powerUp) ``` To retrieve a node from the scene, use the `get(_:)` or `resolve(_:)` methods, passing in the appropriate key: ```swift if let player = get(.player(0)) { // Do something with the player node } ``` You can also create plugins to modify properties of nodes in a type-safe way. Here's an example: ```swift struct PositionPlugin: Plugin { var keyPath: WritableKeyPath<PlanarNode, CGPoint> func handle(value: CGPoint, output: inout CGPoint) async throws { output = value } } let playerNode = PlanarNode(node: SKSpriteNode(imageNamed: "player")) let positionPlugin = PositionPlugin(keyPath: \.position) try await playerNode.handle(value: CGPoint(x: 100, y: 100)) ``` In this example, we create a `PositionPlugin` that modifies the `position` property of a `PlanarNode`. We then create a `PlanarNode` representing a player, and use the `handle` method to apply the `PositionPlugin` to set the player's position to (100, 100). *** **Full Changelog**: https://github.com/0xOpenBytes/Planar/commits/0.1.0
iOS macOS watchOS tvOS
0xOpenBytes/Network 0.1.0
πŸ•ΈοΈ Output and Input for remote URLs using REST
⭐️ 2
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.1.0
1 year ago
# Network Network is a convenience typealias for `o.url` that represents network access. `o.url` is a group of functions in the `o` module that provides network access and manipulation operations. ## Usage To use `Network`, simply import `Network` and use the `Network` typealias in your code: ```swift import Network // Get data from a URL let data = try await Network.get(url: URL(string: "https://example.com/data.json")!) // Post data to a URL let postData = "Hello, world!".data(using: .utf8)! try await Network.post(url: URL(string: "https://example.com/post")!, body: postData) ``` *** **Full Changelog**: https://github.com/0xLeif/Network/commits/0.1.0
iOS macOS watchOS tvOS
0xOpenBytes/Disk 0.1.0
πŸ’Ύ Output and Input for Files
⭐️ 2
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.1.0
1 year ago
# Disk Disk is a convenience typealias for `o.file` that represents a file system disk. It provides easy access to the file system and its manipulation operations. ## Usage Here are some examples of how you can use Disk: ```swift // Read the contents of a file let data = try Disk.data(filename: "file.txt") // Write a string to a file try Disk.out("Hello, world!", filename: "greeting.txt") // Delete a file try Disk.delete(filename: "file.txt") ``` *** **Full Changelog**: https://github.com/0xLeif/Disk/commits/0.1.0
iOS macOS watchOS tvOS
0xOpenBytes/Test 0.3.0
πŸ§ͺ Expect and assert
⭐️ 2
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.3.0
1 year ago
## What's Changed * Leif/update dependencies by @0xLeif in https://github.com/0xOpenBytes/Test/pull/2 **Full Changelog**: https://github.com/0xOpenBytes/Test/compare/0.2.0...0.3.0
0.2.0
1 year ago
## What's Changed * Add Waitable and Waiter. Update Tests errors by @0xLeif in https://github.com/0xOpenBytes/Test/pull/1 **Full Changelog**: https://github.com/0xOpenBytes/Test/compare/0.1.0...0.2.0
0.1.0
1 year ago
# Test *Expect and assert* ## What is `Test`? `Test` is a simple testing function that allows you to create test suites with multiple steps, expectations, and assertions. You can specify a name for the test suite, an instance of the `Tester` class to be used for running the tests, and a closure that contains the test steps. ## Where can `Test` be used? `Test` can be used anywhere! `Test` can be used to test quickly inside a function to make sure something is working as expected. It is especially useful when you want to test a complex piece of code with multiple steps and assertions. `Test` can even be used for your unit tests! ## Examples ### Simple test with assertions ```swift try await Test(named: "Test someMethod()") { tester in try tester.assert(SomeClass.someMethod()) try await tester.assertNoThrows(try await SomeClass.someOtherMethod()) try tester.assert(SomeClass.someBooleanValue, isEqualTo: false) } ``` ### Test with expectations ```swift try Test(named: "Test someMethod() with expectations") { tester in try Expect("First step should succeed") { try SomeClass.someMethod() } tester.logInfo("Just finished first step") try Expect("Second step should succeed") { try SomeClass.someOtherMethod() } tester.logWarning("Something unexpected happened during the second step") try Expect("Final assertion should be true") { try tester.assert(SomeClass.someBooleanValue) } tester.logSuccess("All steps and assertions passed!") } ``` *** **Full Changelog**: https://github.com/0xLeif/Test/commits/0.1.0
iOS macOS watchOS tvOS
0xOpenBytes/OpenBytesNavigation 0.1.0
πŸ“š Easy-to-use navigation system for SwiftUI apps
⭐️ 2
πŸ•“ 1 year ago
πŸ”– Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.1.0
1 year ago
# OpenBytesNavigation OpenBytesNavigation is a SwiftUI library that provides a flexible and easy-to-use navigation system for your SwiftUI apps. It allows you to navigate between views, show modal views, display alerts and action sheets, and show toast notifications. ## Usage To use OpenBytesNavigation, you need to create an instance of `OpenBytesNavigationPath`, which keeps track of the navigation state. You can then use the `OpenBytesNavigationView` view to display your content and provide navigation functionality. ```swift import OpenBytesNavigation import SwiftUI struct ContentView: View { @ObservedObject private var path = OpenBytesNavigationPath(id: "path_id") var body: some View { OpenBytesNavigationView(path: path) { // your content here } } } ``` ## Navigation Examples ### SwiftUI Previews Call the `preview` function on `OpenBytesNavigationView` to create a preview of your navigation stack. This is useful for SwiftUI previews as the path won't be able to save. ```swift struct ExampleView_Previews: PreviewProvider { static var previews: some View { OpenBytesNavigationView.preview { // your content here } } } ``` ### Action Sheet ```swift path.actionSheet( title: "Delete Item?", actions: { Button("Delete", role: .destructive) { // Delete item } }, message: { Text("Are you sure you want to delete this item?") } ) ``` ### Alert ```swift path.alert( title: Text("Error"), message: Text("An error occurred. Please try again."), primaryButton: .default(Text("OK")), secondaryButton: .cancel() ) ``` ### Modal ```swift path.modal( body: { Text("Modal body") } ) ``` ### Toast ```swift path.toast( title: "Success", message: "Item saved successfully", style: .success ) ``` ### Push ```swift .navigationDestination(for: Date.self, destination: { DateView(date: $0) }) ... path.push(Date()) ``` ### Pop ```swift path.pop() ``` ### Save and Load ```swift let id = "test" let path = OpenBytesNavigationPath(id: id, isPreview: false) XCTAssertEqual(path.navigation.count, 0) path.push("Value") XCTAssertEqual(path.navigation.count, 1) path.save() let loadedPath = OpenBytesNavigationPath.load(id: id) XCTAssertEqual(loadedPath.navigation.count, path.navigation.count) ``` *** **Full Changelog**: https://github.com/0xOpenBytes/OpenBytesNavigation/commits/0.1.0
iOS macOS watchOS tvOS

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