Skip to content

Commit

Permalink
Merge pull request #5 from gobetti/read-only-badge-value
Browse files Browse the repository at this point in the history
Replace Binding<String?> by String? for read-only access
  • Loading branch information
NicholasBellucci authored Sep 29, 2020
2 parents 1b96742 + c8cd92f commit c8aebfe
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/StatefulTabView/Helpers/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ public struct Tab {

internal var prefersLargeTitle: Bool = false

@Binding var badgeValue: String?
let badgeValue: String?

public init<T>(title: String,
imageName: String,
badgeValue: Binding<String?> = .constant(nil),
badgeValue: String? = nil,
@ViewBuilder content: @escaping () -> T) where T: View {

_badgeValue = badgeValue
self.badgeValue = badgeValue
barItem = UITabBarItem(title: title, image: UIImage(named: imageName), selectedImage: nil)

self.view = AnyView(content())
}

public init<T>(title: String,
systemImageName: String,
badgeValue: Binding<String?> = .constant(nil),
badgeValue: String? = nil,
@ViewBuilder content: @escaping () -> T) where T: View {

_badgeValue = badgeValue
self.badgeValue = badgeValue
barItem = UITabBarItem(title: title, image: UIImage(systemName: systemImageName), selectedImage: nil)

self.view = AnyView(content())
}

public init<T>(title: String,
image: UIImage?,
badgeValue: Binding<String?> = .constant(nil),
badgeValue: String? = nil,
@ViewBuilder content: @escaping () -> T) where T: View {

_badgeValue = badgeValue
self.badgeValue = badgeValue
barItem = UITabBarItem(title: title, image: image, selectedImage: nil)

self.view = AnyView(content())
Expand Down

0 comments on commit c8aebfe

Please sign in to comment.