Files
damus/damus/Util/Extensions/FillAndStroke.swift
William Casarin 1db425fd69 ui: add AlbyButton
This will be used for alby's nostr wallet connect implementation
2023-05-09 18:57:04 -07:00

26 lines
707 B
Swift

//
// FillAndStroke.swift
// damus
//
// Created by William Casarin on 2023-05-09.
//
import Foundation
import SwiftUI
extension Shape {
func fill<Fill: ShapeStyle, Stroke: ShapeStyle>(_ fillStyle: Fill, strokeBorder strokeStyle: Stroke, lineWidth: Double = 1) -> some View {
self
.stroke(strokeStyle, lineWidth: lineWidth)
.background(self.fill(fillStyle))
}
}
extension InsettableShape {
func fill<Fill: ShapeStyle, Stroke: ShapeStyle>(_ fillStyle: Fill, strokeBorder strokeStyle: Stroke, lineWidth: Double = 1) -> some View {
self
.strokeBorder(strokeStyle, lineWidth: lineWidth)
.background(self.fill(fillStyle))
}
}