neothXT / ListableProperties

ListableProperties macro allows to list all the properties of a struct, class and other types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ListableProperties

ListableProperties macro allows to list all the properties of a struct, class and other types by adding static getProperties() func to it. All you need to do is to add @ListableProperties to your model.

Installation

ListableProperties is currently available only via SPM (Swift Package Manager)

Basic Usage

@ListableProperties
struct Model {
    let firstProperty: String
    let secondProperty: Int
    var thirdProperty: Bool
}

print(Model.getProperties()) // This will return ["firstProperty", "secondProperty", "thirdProperty"]

And that's it. Enjoy :)

About

ListableProperties macro allows to list all the properties of a struct, class and other types

License:Apache License 2.0


Languages

Language:Swift 100.0%