GBA-8-19/Features/Types/DisplayInlineKey.swift
bluesea 2d62f40b7c s
2024-06-14 18:16:51 +08:00

28 lines
512 B
Swift

//
// DisplayInlineKey.swift
// HthikFeatures
//
// Created by Hthik on 4/11/23.
// Copyright © 2024 Hthik
//
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)
}
}