diff --git a/Delta.xcodeproj/project.pbxproj b/Delta.xcodeproj/project.pbxproj index d9856bf..2cdfeb2 100644 --- a/Delta.xcodeproj/project.pbxproj +++ b/Delta.xcodeproj/project.pbxproj @@ -197,6 +197,7 @@ D5D7C20629E60F6100663793 /* OptionPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D592D6FE29E48FFB008D218A /* OptionPickerView.swift */; }; D5D7C20829E616CF00663793 /* FeatureContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5D7C20729E616CF00663793 /* FeatureContainer.swift */; }; D5D7C20A29E61FA600663793 /* OptionToggleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5D7C20929E61FA600663793 /* OptionToggleView.swift */; }; + D5D7C20C29E624CB00663793 /* DisplayInlineKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5D7C20B29E624CB00663793 /* DisplayInlineKey.swift */; }; D5F82FB82981D3AC00B229AF /* LegacySearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F82FB72981D3AC00B229AF /* LegacySearchBar.swift */; }; /* End PBXBuildFile section */ @@ -441,6 +442,7 @@ D5D7C1F129E60DFF00663793 /* libDeltaFeatures.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDeltaFeatures.a; sourceTree = BUILT_PRODUCTS_DIR; }; D5D7C20729E616CF00663793 /* FeatureContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureContainer.swift; sourceTree = ""; }; D5D7C20929E61FA600663793 /* OptionToggleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionToggleView.swift; sourceTree = ""; }; + D5D7C20B29E624CB00663793 /* DisplayInlineKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayInlineKey.swift; sourceTree = ""; }; D5F82FB72981D3AC00B229AF /* LegacySearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacySearchBar.swift; sourceTree = ""; }; DC866E433B3BA9AE18ABA1EC /* libPods-Delta.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Delta.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -998,6 +1000,7 @@ D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */, D5D7C1E629E5F90200663793 /* OptionValue.swift */, D5D7C1E829E5FCDE00663793 /* LocalizedOptionValue.swift */, + D5D7C20B29E624CB00663793 /* DisplayInlineKey.swift */, ); path = Types; sourceTree = ""; @@ -1558,6 +1561,7 @@ D5D7C20429E60F2000663793 /* Feature.swift in Sources */, D55C469129E7631000EA6DE9 /* AnyOption.swift in Sources */, D5D7C1FD29E60EEF00663793 /* OptionalProtocol.swift in Sources */, + D5D7C20C29E624CB00663793 /* DisplayInlineKey.swift in Sources */, D5D7C20A29E61FA600663793 /* OptionToggleView.swift in Sources */, D55C468F29E761C000EA6DE9 /* AnyFeature.swift in Sources */, D5D7C20129E60F2000663793 /* LocalizedOptionValue.swift in Sources */, diff --git a/DeltaFeatures/Types/DisplayInlineKey.swift b/DeltaFeatures/Types/DisplayInlineKey.swift new file mode 100644 index 0000000..e311ea1 --- /dev/null +++ b/DeltaFeatures/Types/DisplayInlineKey.swift @@ -0,0 +1,27 @@ +// +// DisplayInlineKey.swift +// DeltaFeatures +// +// Created by Riley Testut on 4/11/23. +// Copyright © 2023 Riley Testut. All rights reserved. +// + +import SwiftUI + +public struct DisplayInlineKey: PreferenceKey +{ + public static var defaultValue: Bool = false + + public static func reduce(value: inout Bool, nextValue: () -> Bool) + { + value = nextValue() + } +} + +public extension View +{ + func displayInline(_ value: Bool = true) -> some View + { + self.preference(key: DisplayInlineKey.self, value: value) + } +} diff --git a/DeltaFeatures/Views/OptionPickerView.swift b/DeltaFeatures/Views/OptionPickerView.swift index 3232f88..886b72c 100644 --- a/DeltaFeatures/Views/OptionPickerView.swift +++ b/DeltaFeatures/Views/OptionPickerView.swift @@ -23,6 +23,7 @@ public struct OptionPickerView: View value.localizedDescription } } - .pickerStyle(.inline) + .pickerStyle(.menu) + .displayInline() } } diff --git a/DeltaFeatures/Views/OptionToggleView.swift b/DeltaFeatures/Views/OptionToggleView.swift index 0cdf59b..7d88832 100644 --- a/DeltaFeatures/Views/OptionToggleView.swift +++ b/DeltaFeatures/Views/OptionToggleView.swift @@ -18,5 +18,6 @@ public struct OptionToggleView: View public var body: some View { Toggle(name, isOn: $selectedValue) + .displayInline() } }