Skip to content

Commit

Permalink
Rename label shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Apr 29, 2024
1 parent ad529f1 commit 5c11963
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Sources/SwiftUIKit/Extensions/Label+Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ import SwiftUI

public extension Label where Icon == Image, Title == Text {

/// Create a label with a string and a plain image icon.
@available(*, deprecated, renamed: "init(_:_:)")
init(_ text: LocalizedStringKey, image: Image) {
self.init {
Text(text)
} icon: {
image
}
}

/// Create a label with a string and a plain image icon.
init(_ text: LocalizedStringKey, _ image: Image) {
self.init {
Text(text)
} icon: {
image
}
}
}
2 changes: 1 addition & 1 deletion Sources/SwiftUIKit/Lists/ListButtonGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private extension ButtonStyle where Self == ListButtonGroupStyle {
private extension String {

func previewButton(_ icon: Image) -> some View {
Button {} label: { Label(LocalizedStringKey(self), image: icon) }
Button {} label: { Label(LocalizedStringKey(self), icon) }
}
}

Expand Down

0 comments on commit 5c11963

Please sign in to comment.