GBA001/DeltaFeatures/Types/DisplayInlineKey.swift
Riley Testut ef47d78c64 [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.
2023-04-14 18:23:34 -05:00

28 lines
547 B
Swift

//
// 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)
}
}