Skip to content

Commit

Permalink
• Slight SettingsImageButton improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Rspoon3 committed Aug 5, 2021
1 parent 658fbd6 commit de9689a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Sources/RSWTools/Views/Settings/SettingsImageButton.swift
Expand Up @@ -15,7 +15,10 @@ public struct SettingsImageButton: View {
let size: CGFloat
let action: ()->()

public init(_ text: String, image: Image, color: Color? = nil, size:Int = 30, action: @escaping ()->()){
public init(_ text: String,
image: Image, color: Color? = nil,
size:Int = 30,
action: @escaping ()->()){
self.text = text
self.image = image
self.color = color
Expand All @@ -29,7 +32,8 @@ public struct SettingsImageButton: View {
}, label: {
HStack{
Text(text)
Spacer()
.frame(maxWidth: .infinity, alignment: .leading)

ZStack{
if let color = color{
color
Expand All @@ -50,7 +54,9 @@ public struct SettingsImageButton: View {
struct SettingsImageButton_Previews: PreviewProvider {
static var previews: some View {
Form{
SettingsImageButton("Privacy Policy", image: Image(symbol: .handRaisedFill), color: .accentColor, size: 20){}
SettingsImageButton("Privacy Policy",
image: Image(symbol: .handRaisedFill),
color: .accentColor, size: 20){}
}
}
}

0 comments on commit de9689a

Please sign in to comment.