Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS-3708 Integrate @Entry macro #2349

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,9 @@ final class AppInterfaceStyle {
}
}

struct AppInterfaceStyleKey: EnvironmentKey {
static let defaultValue = AppInterfaceStyle(window: nil)
}

extension EnvironmentValues {
var appInterfaceStyle: AppInterfaceStyle {
get { self[AppInterfaceStyleKey.self] }
set { self[AppInterfaceStyleKey.self] = newValue }
}
@Entry var appInterfaceStyle = AppInterfaceStyle(window: nil)
}

extension View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct KeyboardDismiss: EnvironmentKey {
static let defaultValue: () -> Void = {}
}

extension EnvironmentValues {
var keyboardDismiss: () -> Void {
get { self[KeyboardDismiss.self] }
set { self[KeyboardDismiss.self] = newValue }
}
@Entry var keyboardDismiss: () -> Void = {}
}

extension View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ struct DismissAllPresented: Equatable {
}
}

struct PresentedDismissKey: EnvironmentKey {
static let defaultValue = DismissAllPresented(window: nil)
}

extension EnvironmentValues {
var dismissAllPresented: DismissAllPresented {
get { self[PresentedDismissKey.self] }
set { self[PresentedDismissKey.self] = newValue }
}
@Entry var dismissAllPresented = DismissAllPresented(window: nil)
}

extension View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct StandardButtonGroupDisableKey: EnvironmentKey {
static let defaultValue: Binding<Bool> = .constant(false)
}

extension EnvironmentValues {
var standardButtonGroupDisable: Binding<Bool> {
get { self[StandardButtonGroupDisableKey.self] }
set { self[StandardButtonGroupDisableKey.self] = newValue }
}
@Entry var standardButtonGroupDisable: Binding<Bool> = .constant(false)
}

struct AsyncStandardButtonGroup<Content: View>: View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct AnytypeDragAndDropFrames: EnvironmentKey {
static let defaultValue = DragAndDropFrames()
}

extension EnvironmentValues {
var anytypeDragAndDropFrames: DragAndDropFrames {
get { self[AnytypeDragAndDropFrames.self] }
set { self[AnytypeDragAndDropFrames.self] = newValue }
}
@Entry var anytypeDragAndDropFrames = DragAndDropFrames()
}

final class DragAndDropFrames {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct AnytypeDragState: EnvironmentKey {
static let defaultValue: Binding<DragState> = .constant(DragState())
}

extension EnvironmentValues {
var anytypeDragState: Binding<DragState> {
get { self[AnytypeDragState.self] }
set { self[AnytypeDragState.self] = newValue }
}
@Entry var anytypeDragState: Binding<DragState> = .constant(DragState())
}

struct DropDataElement<Data> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct AnytypeNavigationPanelSizeEnvironmentKey: EnvironmentKey {
static let defaultValue = CGSize.zero
}

extension EnvironmentValues {
var anytypeNavigationPanelSize: CGSize {
get { self[AnytypeNavigationPanelSizeEnvironmentKey.self] }
set { self[AnytypeNavigationPanelSizeEnvironmentKey.self] = newValue }
}
@Entry var anytypeNavigationPanelSize = CGSize.zero
}

extension View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

struct AnytypeNavigationItemDataEnvironmentKey: EnvironmentKey {
static let defaultValue: AnyHashable? = nil
}

extension EnvironmentValues {
var anytypeNavigationItemData: AnyHashable? {
get { self[AnytypeNavigationItemDataEnvironmentKey.self] }
set { self[AnytypeNavigationItemDataEnvironmentKey.self] = newValue }
}
@Entry var anytypeNavigationItemData: AnyHashable? = nil
}

extension View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ struct PageNavigation {
let replace: (EditorScreenData) -> Void
}

struct PageNavigationEnvironmentKey: EnvironmentKey {
static let defaultValue: PageNavigation = PageNavigation(push: { _ in }, pop: { }, replace: { _ in })
}

extension EnvironmentValues {
var pageNavigation: PageNavigation {
get { self[PageNavigationEnvironmentKey.self] }
set { self[PageNavigationEnvironmentKey.self] = newValue }
}
@Entry var pageNavigation = PageNavigation(push: { _ in }, pop: { }, replace: { _ in })
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import Foundation
import SwiftUI

private struct HomeBottomPanelStateEnvironmentKey: EnvironmentKey {
static let defaultValue = Binding.constant(HomeBottomPanelState())
}

private extension EnvironmentValues {
var homeBottomPanelState: Binding<HomeBottomPanelState> {
get { self[HomeBottomPanelStateEnvironmentKey.self] }
set { self[HomeBottomPanelStateEnvironmentKey.self] = newValue }
}
@Entry var homeBottomPanelState = Binding.constant(HomeBottomPanelState())
}

private struct HomeBottomHiddenStateViewModifier: ViewModifier {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import Foundation
import SwiftUI

struct NotificationDismissKey: EnvironmentKey {
static let defaultValue: () -> Void = {}
}

extension EnvironmentValues {
var notificationDismiss: () -> Void {
get { self[NotificationDismissKey.self] }
set { self[NotificationDismissKey.self] = newValue }
}
@Entry var notificationDismiss: () -> Void = {}
}
Loading