Skip to content

Commit

Permalink
Updated CircledNumber to take a ShapeStyle for the stroke content of …
Browse files Browse the repository at this point in the history
…the circle (#23)

Co-authored-by: Giulia Ariu <[email protected]>
  • Loading branch information
GiuliaAriu and GiuliaAriu authored May 27, 2021
1 parent 2fd522c commit d22a491
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

import SwiftUI

public struct CircledNumber<Content: View>: View {
public struct CircledNumber<Content: View, S: ShapeStyle>: View {
private let length: CGFloat
private let content: Content
private let strokeContent: S

public init(number: Int, length: CGFloat, @ViewBuilder content: @escaping (Int) -> Content) {
public init(number: Int, length: CGFloat, strokeContent: S, @ViewBuilder content: @escaping (Int) -> Content) {
self.content = content(number)
self.length = length
self.strokeContent = strokeContent
}
public var body: some View {
content
.squared(length: length)
.background(Circle().stroke(Color.black), alignment: .center)
.background(Circle().stroke(strokeContent), alignment: .center)
}
}

Expand Down

0 comments on commit d22a491

Please sign in to comment.