Skip to content

Commit 08162a7

Browse files
Reimplement SwiftUI version
1 parent 8b25ac5 commit 08162a7

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

Sources/SPSettingsIcons/Image+Extension.swift renamed to Sources/SPSettingsIcons/SettingsIcon.swift

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,17 @@
2121

2222
import SwiftUI
2323

24-
extension Image {
24+
public struct SettingsIcon: View {
2525

26-
/// Apply settings style for Image
27-
///
28-
/// Example:
29-
///
30-
/// Image(systemName: "wifi")
31-
/// .settingStyle(color: .blue)
32-
///
33-
public func settingStyle(color: Color) -> some View {
34-
self
35-
.modifier(SettingsImageModifier())
36-
.foregroundColor(color)
37-
}
38-
39-
}
40-
41-
struct SettingsImageModifier: ViewModifier {
26+
let systemName: String
27+
let backgroundColor: Color
4228

43-
func body(content: Content) -> some View {
29+
public var body: some View {
4430
ZStack {
4531
Image(systemName: "app.fill")
4632
.font(.system(size: 32))
47-
content
33+
.foregroundColor(backgroundColor)
34+
Image(systemName: systemName)
4835
.font(.system(size: 16))
4936
.foregroundColor(.white)
5037
}

0 commit comments

Comments
 (0)