[Features] Adds displayInline(_:) View modifier
Controls whether @Option detailView will be displayed inline in the Feature detail view in Delta’s settings, or as a full-screen view that’s pushed onto navigation stack when tapped.
This commit is contained in:
parent
9f40223e6c
commit
ef47d78c64
@ -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 = "<group>"; };
|
||||
D5D7C20929E61FA600663793 /* OptionToggleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionToggleView.swift; sourceTree = "<group>"; };
|
||||
D5D7C20B29E624CB00663793 /* DisplayInlineKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayInlineKey.swift; sourceTree = "<group>"; };
|
||||
D5F82FB72981D3AC00B229AF /* LegacySearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacySearchBar.swift; sourceTree = "<group>"; };
|
||||
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 = "<group>";
|
||||
@ -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 */,
|
||||
|
||||
27
DeltaFeatures/Types/DisplayInlineKey.swift
Normal file
27
DeltaFeatures/Types/DisplayInlineKey.swift
Normal file
@ -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)
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,7 @@ public struct OptionPickerView<Value: LocalizedOptionValue>: View
|
||||
value.localizedDescription
|
||||
}
|
||||
}
|
||||
.pickerStyle(.inline)
|
||||
.pickerStyle(.menu)
|
||||
.displayInline()
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,5 +18,6 @@ public struct OptionToggleView: View
|
||||
|
||||
public var body: some View {
|
||||
Toggle(name, isOn: $selectedValue)
|
||||
.displayInline()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user