IDKit

1.1.3

Simple and lightweight library that provides a set of classes and functions to work with identifiers
NikSativa/IDKit

What's New

1.1.3

2024-04-17T15:25:24Z

Full Changelog: 1.1.2...1.1.3

IDKit

Simple and lightweight library that provides a set of classes and functions to work with identifiers.

AnyID

No longer need to use String or Int for your identifiers. Just use AnyID and forget about type casting.

struct User: Codable {
    let id: AnyID
    let name: String
    let age: Int
}

ID

ID represents an identifier as a strong type identifier.

IDRepresentable

Protocol can be used to define your custom identifier types.

struct User: IDRepresentable {
    // let id: AnyID  <-- property is not required
    let name: String
    let age: Int
}

// but in any place you can identify your strong type id
let identifier: ID<User> 

Identifying

It's like combine of ID and IDRepresentable protocols. It's required to have a property with name id of type ID<Self>.

struct User: Identifying {
    let id: ID<Self> <-- property is required
}

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Fri May 03 2024 04:54:05 GMT-0900 (Hawaii-Aleutian Daylight Time)