david-swift 04c77831b5
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Waiting to run
Remove Core library
2025-10-30 21:36:13 +01:00

49 lines
1.1 KiB
Swift

//
// Menu+.swift
// Adwaita
//
// Created by david-swift on 21.10.23.
//
import CAdw
extension Menu {
// swiftlint:disable function_default_parameter_at_end
/// Initialize a menu button.
/// - Parameters:
/// - label: The button's label.
/// - icon: The button's icon.
/// - content: The menu's content.
public init(
_ label: String? = nil,
icon: Icon,
@ViewBuilder content: @escaping () -> Body
) {
self.init()
self = self
.child {
ButtonContent()
.iconName(icon.string)
.label(label)
}
.menuModel(content)
}
// swiftlint:enable function_default_parameter_at_end
/// Initialize a menu button.
/// - Parameters:
/// - label: The buttons label.
/// - content: The menu's content.
public init(
_ label: String,
@ViewBuilder content: @escaping () -> Body
) {
self.init()
self = self
.label(label)
.menuModel(content)
}
}