Skip to content

A collection of Swift macros to reduce boilerplate for building applications

License

Notifications You must be signed in to change notification settings

appbiotic/appbiotic-macros-swift

Repository files navigation

AppbioticMacros

A collection of Swift macros to reduce boilerplate for building applications.

Installation

Package dependency:

.package(url: "https://github.com/appbiotic/appbiotic-macros-swift", exact: "0.2.0")

Target dependency:

.product(name: "AppbioticMacros", package: "appbiotic-macros-swift")

Usage

prefix

import AppbioticMacros
import NotificationCenter

@NotificationNames(prefix: "com.example.app.")
public enum AppEvent {
    case startedSomething
    case stoppedSomething
}

Expands to:

import AppbioticMacros
import NotificationCenter

public enum AppEvent {
    case startedSomething
    case stoppedSomething

    public var notificationName: Notification.Name {
        get {
            switch self {
            case .startedService:
                return Notification.Name("com.example.app.startedSomething")
            case .stoppedService:
                return Notification.Name("com.example.app.startedSomething")
            }
        }
    }
}

Support

This software package is provided on an "as-is" basis. Community-based support is available in discussions. Filed issues may be renamed, split, deduplicated, or moved to a discussion, for organizational clarity purposes.

About

A collection of Swift macros to reduce boilerplate for building applications

Resources

License

Stars

Watchers

Forks

Languages