Skip to content

Commit

Permalink
Making picker view selection required
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaal111 committed Jan 1, 2024
1 parent ee694b5 commit 48953dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct PreferenceOptionsScreen: View {
AppText(string: option.label)
.bold()
Spacer()
if isSelected(option) {
if self.isSelected(option) {
Image(systemName: "checkmark")
.kBold()
}
Expand All @@ -46,7 +46,7 @@ struct PreferenceOptionsScreen: View {
}

private func isSelected(_ option: Preference.Option) -> Bool {
preference.selectedOption == option
self.preference.selectedOption == option
}

private func searchFilter(_ option: Preference.Option, _ searchText: String) -> Bool {
Expand Down
4 changes: 2 additions & 2 deletions Sources/KamaalUI/Views/KTitledPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import SwiftUI

public struct KTitledPicker<Item: Hashable, PickerItemView: View>: View {
@Binding var selection: Item?
@Binding var selection: Item

let title: String
let items: [Item]
let pickerItemView: (_ item: Item) -> PickerItemView

public init(
selection: Binding<Item?>,
selection: Binding<Item>,
title: String,
items: [Item],
@ViewBuilder pickerItemView: @escaping (_ item: Item) -> PickerItemView
Expand Down

0 comments on commit 48953dd

Please sign in to comment.