SlideShare a Scribd company logo
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
Accessibility APIs
navigationBarTitle(_:)
edgesIgnoringSafeArea(_:)
colorScheme(_:)
contextMenu(_:)
navigationBarItems(_:)
Drag & Drop UTI (String)
navigationTitle(_:)


navigationBarTitleDisplayMode(_:)
ignoresSafeArea(_:edges:)
preferredColorScheme(_:)
contextMenu(menuItems:)
toolbar(content:)
Drag & Drop UTI (UTType)
DeprecatedAPI로 알아보는 SwiftUI
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


...


}
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


...


}
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


...


}
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


@available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)")


func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


...


}


@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)


extension View {


func accessibilityHidden(_ hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityLabel(_ label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityValue(_ value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityHint(_ hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


...


}
DeprecatedAPI로 알아보는 SwiftUI
min(number1, number2)


zip(sequence1, sequence2)
min(number1, number2)


zip(sequence1, sequence2)
min(number1, number2)


zip(sequence1, sequence2)
UInt32(someUInt16number)


Int64(someInt8number)
min(number1, number2)


zip(sequence1, sequence2)
UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535


UInt16(bigEndian: 123) // 123 -> 31488
UInt32(someUInt16number)


Int64(someInt8number)
min(number1, number2)


zip(sequence1, sequence2)
UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535


UInt16(bigEndian: 123) // 123 -> 31488
UInt32(someUInt16number)


Int64(someInt8number)
min(number1, number2)


zip(sequence1, sequence2)
func trimmedPath(from: CGFloat, to: CGFloat) -> Path


func move(to p: CGPoint)
UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535


UInt16(bigEndian: 123) // 123 -> 31488
UInt32(someUInt16number)


Int64(someInt8number)
DeprecatedAPI로 알아보는 SwiftUI
func addSubview(_ view: UIView)


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
func addSubview(_ view: UIView)


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
func addSubview(_ view: UIView)


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
func add(Subview view: UIView)
func addSubview(_ view: UIView)


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
⛔
func add(Subview view: UIView)
func addSubview(_ view: UIView)


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
func accessibilityHidden(_ hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityLabel(_ label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityValue(_ value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibilityHint(_ hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
✅
func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>


func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
⛔
func add(Subview view: UIView)
Slider(value: $opacity) { Text("Slider") }


.accessibilityLabel("Opacity slider")


.accessibilityAction(.escape) { opacity = 0.0 }


.accessibilityAction(.magicTap) { opacity = 1.0 }


.accessibilityAdjustableAction { direction in


switch direction {


case .increment: opacity += 0.05


case .decrement: opacity -= 0.05


default: break


}


}
Slider(value: $opacity) { Text("Slider") }


.accessibilityLabel("Opacity slider")


.accessibilityAction(.escape) { opacity = 0.0 }


.accessibilityAction(.magicTap) { opacity = 1.0 }


.accessibilityAdjustableAction { direction in


switch direction {


case .increment: opacity += 0.05


case .decrement: opacity -= 0.05


default: break


}


}
Slider(value: $opacity) { Text("Slider") }


.accessibilityLabel("Opacity slider")


.accessibilityAction(.escape) { opacity = 0.0 }


.accessibilityAction(.magicTap) { opacity = 1.0 }


.accessibilityAdjustableAction { direction in


switch direction {


case .increment: opacity += 0.05


case .decrement: opacity -= 0.05


default: break


}


}
Slider(value: $opacity) { Text("Slider") }


.accessibilityLabel("Opacity slider")


.accessibilityAction(.escape) { opacity = 0.0 }


.accessibilityAction(.magicTap) { opacity = 1.0 }


.accessibilityAdjustableAction { direction in


switch direction {


case .increment: opacity += 0.05


case .decrement: opacity -= 0.05


default: break


}


}
Image(decorative: "SwiftUI")


.opacity(opacity)


Text("SwiftUI Logo Image")

.font(.caption)


.opacity(opacity)


.onTapGesture { opacity += 0.1 }

.accessibilityValue("Opacity (opacity, specifier: "%.2f")")


.accessibilityAddTraits(.isButton)


.accessibilityScrollAction { (edge) in


switch edge {


case .top: opacity -= 0.5


case .bottom: opacity += 0.5


case .leading: opacity -= 0.2


case .trailing: opacity += 0.2


}


}
Image(decorative: "SwiftUI")


.opacity(opacity)


Text("SwiftUI Logo Image")

.font(.caption)


.opacity(opacity)


.onTapGesture { opacity += 0.1 }

.accessibilityValue("Opacity (opacity, specifier: "%.2f")")


.accessibilityAddTraits(.isButton)


.accessibilityScrollAction { (edge) in


switch edge {


case .top: opacity -= 0.5


case .bottom: opacity += 0.5


case .leading: opacity -= 0.2


case .trailing: opacity += 0.2


}


}
Image(decorative: "SwiftUI")


.opacity(opacity)


Text("SwiftUI Logo Image")

.font(.caption)


.opacity(opacity)


.onTapGesture { opacity += 0.1 }

.accessibilityValue("Opacity (opacity)")


.accessibilityAddTraits(.isButton)


.accessibilityScrollAction { (edge) in


switch edge {


case .top: opacity -= 0.5


case .bottom: opacity += 0.5


case .leading: opacity -= 0.2


case .trailing: opacity += 0.2


}


}
Image(decorative: "SwiftUI")


.opacity(opacity)


Text("SwiftUI Logo Image")

.font(.caption)


.opacity(opacity)


.onTapGesture { opacity += 0.1 }

.accessibilityValue("Opacity (opacity, specifier: "%.2f")")


.accessibilityAddTraits(.isButton)


.accessibilityScrollAction { (edge) in


switch edge {


case .top: opacity -= 0.5


case .bottom: opacity += 0.5


case .leading: opacity -= 0.2


case .trailing: opacity += 0.2


}


}
Image(decorative: "SwiftUI")


.opacity(opacity)


Text("SwiftUI Logo Image")

.font(.caption)


.opacity(opacity)


.onTapGesture { opacity += 0.1 }

.accessibilityValue("Opacity (opacity, specifier: "%.2f")")


.accessibilityAddTraits(.isButton)


.accessibilityScrollAction { (edge) in


switch edge {


case .top: opacity -= 0.5


case .bottom: opacity += 0.5


case .leading: opacity -= 0.2


case .trailing: opacity += 0.2


}


}
DeprecatedAPI로 알아보는 SwiftUI
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View


}
@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


extension View {


func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View


}
@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.")


extension View {


func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View


}


@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)


extension View {


func ignoresSafeArea(_ regions: SafeAreaRegions = .all, edges: Edge.Set = .all) -> some View


}
DeprecatedAPI로 알아보는 SwiftUI
[ ignore (.all) ][ 미적용 ]
[ ignore (.all) ][ 미적용 ] [ ignore (.keyboard) ]
[ ignore (.all) ] [ ignore (.container) ][ 미적용 ] [ ignore (.keyboard) ]
[ .top ][ 미적용 ]
[ .top ][ 미적용 ] [ .top, .bottom ]
[ .top ] [ .bottom ][ 미적용 ] [ .top, .bottom ]
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


func colorScheme(_ colorScheme: ColorScheme) -> some View


}
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


func colorScheme(_ colorScheme: ColorScheme) -> some View


}
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


func colorScheme(_ colorScheme: ColorScheme) -> some View


}


SomeView()


.colorScheme(.dark)


SomeView()


.environment(.colorScheme, .dark)
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)")


func colorScheme(_ colorScheme: ColorScheme) -> some View


}


@available(iOS 13.0, macOS 11.0, tvOS 13.0, watchOS 6.0, *)


extension View {


func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View


}
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)


@available(macOS, unavailable)


extension View {


func navigationBarTitle(_ title: Text) -> some View


func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View


func navigationBarTitle<S>(_ title: S) -> some View where S : StringProtocol


func navigationBarTitle(_ title: Text, displayMode: NavigationBarItem.TitleDisplayMode) -> some View


...


}
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)


@available(macOS, unavailable)


extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")


@available(macOS, unavailable)

@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")


@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")


func navigationBarTitle(_ title: Text) -> some View


func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View


func navigationBarTitle<S>(_ title: S) -> some View where S : StringProtocol


@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use navigationTitle(_:) with
navigationBarTitleDisplayMode(_:)")


func navigationBarTitle(_ title: Text, displayMode: NavigationBarItem.TitleDisplayMode) -> some View


...


}
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)


extension View {


func navigationTitle(_ title: Text) -> some View


func navigationTitle(_ titleKey: LocalizedStringKey) -> some View


func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol


}
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)


extension View {


func navigationTitle(_ title: Text) -> some View


func navigationTitle(_ titleKey: LocalizedStringKey) -> some View


func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol


}


@available(iOS 14.0, *)


@available(macOS, unavailable)


@available(tvOS, unavailable)


@available(watchOS, unavailable)


extension View {


func navigationBarTitleDisplayMode(_ displayMode: NavigationBarItem.TitleDisplayMode) -> some View


}
DeprecatedAPI로 알아보는 SwiftUI
NavigationView {


Text("Deprecated APIs Example")


.navigationTitle("Inline Mode Title")


.navigationBarTitleDisplayMode(.inline)


}


NavigationView {


Text("Deprecated APIs Example")


.navigationTitle("Large Mode Title")


.navigationBarTitleDisplayMode(.large)


}
[ inline ] [ large ]
#if os(macOS)


extension View {


func navigationBarTitle<S>(_ title: S) -> some View where S: StringProtocol {


self


}


func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View {


self


}


func navigationBarTitle(_ title: Text) -> some View {


self


}


}


#endif
DeprecatedAPI로 알아보는 SwiftUI
extension View {


@available(iOS 13.0, tvOS 13.0, *)


@available(macOS, unavailable)


@available(watchOS, unavailable)


func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View


func navigationBarItems<L>(leading: L) -> some View where L : View


func navigationBarItems<T>(trailing: T) -> some View where T : View


}
extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading
or navigationBarTrailing placement")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading
or navigationBarTrailing placement")


@available(macOS, unavailable)

@available(watchOS, unavailable)


func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View


func navigationBarItems<L>(leading: L) -> some View where L : View


func navigationBarItems<T>(trailing: T) -> some View where T : View


}
extension View {


@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading
or navigationBarTrailing placement")


@available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading
or navigationBarTrailing placement")


@available(macOS, unavailable)

@available(watchOS, unavailable)


func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View


func navigationBarItems<L>(leading: L) -> some View where L : View


func navigationBarItems<T>(trailing: T) -> some View where T : View


}


@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)


extension View {


func toolbar<Content>(@ViewBuilder content: () -> Content) -> some View where Content : View


func toolbar<Content>(@ToolbarContentBuilder content: () -> Content) -> some View where Content :
ToolbarContent


func toolbar<Content>(id: String, @ToolbarContentBuilder content: () -> Content) -> some View where
Content : CustomizableToolbarContent


}
var body: some View {

NavigationView {


Image("SwiftUI")


.navigationBarItems(leading: leadingItem, trailing: trailingItem)


.navigationBarTitle("NavigationBarItems")


}


}


var leadingItem: some View {


Button(action: { print("Leading Item") }) {


Image(systemName: "bell")


}


}


var trailingItem: some View {


HStack {


Button(action: { print("Trailing Item 1") }) {

Image(systemName: "square.and.arrow.up")


}


Button(action: { print("Trailing Item 2") }) {


Image(systemName: "gear")


}


}


}
NavigationView {


Image("SwiftUI")


.navigationTitle("Toolbar")


.toolbar {


HStack {


Button(action: { print("Toolbar Item 1") }) {


Image(systemName: "square.and.arrow.up")


}


Button(action: { print("Toolbar Item 2") }) {


Image(systemName: "gear")


}


}


}


}
.toolbar {


ToolbarItem(placement: .navigationBarLeading) {


Button(action: { print("Leading Item") }) {


Image(systemName: "bell")


}


}


ToolbarItem(placement: .navigationBarTrailing) {


HStack {


Button(action: { print("Trailing Item 1") }) {


Image(systemName: "square.and.arrow.up")


}


Button(action: { print("Trailing Item 2") }) {


Image(systemName: "gear")


}


}


}


}
DeprecatedAPI로 알아보는 SwiftUI
NavigationView {


Text("Toolbar Action")

.font(.title)


.toolbar {


ToolbarItem(placement: .destructiveAction) {


Button("Delete", action: { presentation.wrappedValue.dismiss() })


}


ToolbarItem(placement: .confirmationAction) {


Button("Confirm", action: { presentation.wrappedValue.dismiss() })


}


ToolbarItem(placement: .cancellationAction) {


Button("Cancel", action: { presentation.wrappedValue.dismiss() })


}


}


}
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
[ .principal (inlineMode) ][ .principal (largeMode) ]
[ .navigation (+ backButton) ][ .navigation ]
[ .navigation (+ backButton) ][ .navigation ]
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
var body: some Scene {


WindowGroup {


ContentView()


}


.commands {


ToolbarCommands()


}


}
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 14.0, *)


extension View {


func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View


}


@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 14.0, *)


extension View {


func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View


}
@available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use `contextMenu(menuItems:)` instead.")


@available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use `contextMenu(menuItems:)` instead.")


@available(tvOS, unavailable)


@available(watchOS, introduced: 6.0, deprecated: 7.0)


extension View {


func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View


}


@available(iOS 13.0, macOS 10.15, tvOS 14.0, *)

@available(watchOS, introduced: 6.0, deprecated: 7.0)


extension View {


func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View


}
var body: some View {

let contextMenu = ContextMenu {


Button(" ") { print(" ...") }


Button(" ") { print(" ...") }


Button(" ") { print(" ...") }


}


return Text(" ")


.foregroundColor(.white)


.padding(10)


.background(Color.green.cornerRadius(10))

.contextMenu(contextMenu)


}
var body: some View {

Text(" ")


.foregroundColor(.white)


.padding(10)


.background(Color.green.cornerRadius(10))


.contextMenu {


Button(" ") { print(" ...") }


Button(" ") { print(" ...") }

Button(" ") { print(" ...") }

}


}
var body: some View {

Menu(" ") {


Button(" ") { print(" ...") }


Button(" ") { print(" ...") }


Button(" ") { print(" ...") }


}


.foregroundColor(.white)


.padding(10)


.background(Color.green.cornerRadius(10))

}
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
DeprecatedAPI로 알아보는 SwiftUI
extension DropInfo {

func hasItemsConforming(to types: [String]) -> Bool


func itemProviders(for types: [String]) -> [NSItemProvider]


}


extension View {


func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider]) -> Bool) -> some View

func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider], CGPoint) -> Bool) -> some View


func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View


}


extension DynamicViewContent {


func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) ->
Void) -> some DynamicViewContent


}
extension DropInfo {

func hasItemsConforming(to types: [String]) -> Bool


func itemProviders(for types: [String]) -> [NSItemProvider]


}


extension View {


func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider]) -> Bool) -> some View

func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider], CGPoint) -> Bool) -> some View


func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View


}


extension DynamicViewContent {


func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) ->
Void) -> some DynamicViewContent


}
extension DropInfo {

func hasItemsConforming(to types: [String]) -> Bool


func itemProviders(for types: [String]) -> [NSItemProvider]


}


extension View {


func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider]) -> Bool) -> some View

func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider], CGPoint) -> Bool) -> some View


func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View


}


extension DynamicViewContent {


func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) ->
Void) -> some DynamicViewContent


}
struct DropInfo {

func hasItemsConforming(to contentTypes: [UTType]) -> Bool


func itemProviders(for contentTypes: [UTType]) -> [NSItemProvider]


}


extension View {


func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider]) -> Bool) -> some View

func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping
([NSItemProvider], CGPoint) -> Bool) -> some View


func onDrop(of supportedContentTypes: [UTType], delegate: DropDelegate) -> some View


}


extension DynamicViewContent {


func onInsert(of supportedContentTypes: [UTType], perform action: @escaping (Int, [NSItemProvider]) -> Void)
-> some DynamicViewContent


}
struct ImageDroppableView: View {


let imageNames = ["cat1", "cat2", "dog1", "dog2"]


var body: some View {


VStack {


HStack {


ForEach(imageNames, id: .self) { imageName -> AnyView in


let imageURL = Bundle.main.url(forResource: imageName, withExtension: "jpg")!


return AnyView(


Image(nsImage: NSImage(byReferencing: imageURL))


.resizable()


.aspectRatio(3/2, contentMode: .fit)


.onDrag { NSItemProvider(object: imageURL as NSURL) }


)


}


}


DropZone()


}


}


}
struct ImageDroppableView: View {


let imageNames = ["cat1", "cat2", "dog1", "dog2"]


var body: some View {


VStack {


HStack {


ForEach(imageNames, id: .self) { imageName -> AnyView in


let imageURL = Bundle.main.url(forResource: imageName, withExtension: "jpg")!


return AnyView(


Image(nsImage: NSImage(byReferencing: imageURL))


.resizable()


.aspectRatio(3/2, contentMode: .fit)


.onDrag { NSItemProvider(object: imageURL as NSURL) }


)


}


}


DropZone()


}


}


}
struct DropZone: View {


@State private var isTargeted = false


@State private var image: NSImage? = nil


var body: some View {


Rectangle()


.fill(isTargeted ? Color.green : Color.secondary)


.overlay(Text("Drop Zone").font(.largeTitle))


.overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit())


.onDrop(of: ["public.file-url"], isTargeted: $isTargeted, perform: { items in


guard let item = items.first else { return false }


item.loadItem(forTypeIdentifier: "public.file-url") { (data, error) in


if let urlData = data as? Data,


let url = URL(dataRepresentation: urlData, relativeTo: nil) {


image = NSImage(byReferencing: url)


}


}


return true


})


}


}
struct DropZone: View {


@State private var isTargeted = false


@State private var image: NSImage? = nil


var body: some View {


Rectangle()


.fill(isTargeted ? Color.green : Color.secondary)


.overlay(Text("Drop Zone").font(.largeTitle))


.overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit())


.onDrop(of: ["public.file-url"], isTargeted: $isTargeted, perform: { items in


guard let item = items.first else { return false }


item.loadItem(forTypeIdentifier: "public.file-url") { (data, error) in


if let urlData = data as? Data,


let url = URL(dataRepresentation: urlData, relativeTo: nil) {


image = NSImage(byReferencing: url)


}


}


return true


})


}


}
struct DropZone: View {


@State private var isTargeted = false


@State private var image: NSImage? = nil


var body: some View {


Rectangle()


.fill(isTargeted ? Color.green : Color.secondary)


.overlay(Text("Drop Zone").font(.largeTitle))


.overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit())


.onDrop(of: [.fileURL], isTargeted: $isTargeted, perform: { items in


guard let item = items.first else { return false }


item.loadItem(forTypeIdentifier: UTType.fileURL.identifier) { (data, error) in


if let urlData = data as? Data,


let url = URL(dataRepresentation: urlData, relativeTo: nil) {


image = NSImage(byReferencing: url)


}


}


return true


})


}


}
import UniformTypeIdentifiers
DeprecatedAPI로 알아보는 SwiftUI
Accessibility APIs
navigationBarTitle(_:)
edgesIgnoringSafeArea(_:)
colorScheme(_:)
contextMenu(_:)
navigationBarItems(_:)
Drag & Drop UTI (String)
navigationTitle(_:)


navigationBarTitleDisplayMode(_:)
ignoresSafeArea(_:edges:)
preferredColorScheme(_:)
contextMenu(menuItems:)
toolbar(content:)
Drag & Drop UTI (UTType)
Fourenn@naver.com

More Related Content

What's hot (13)

PDF
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
Fabio Collini
 
PDF
Юрий Буянов «Squeryl — ORM с человеческим лицом»
e-Legion
 
PDF
jQuery1.2.cheatsheet.v1.0
guest644d1d
 
PDF
Delivering a Responsive UI
Rebecca Murphey
 
PDF
Intro programacion funcional
NSCoder Mexico
 
PDF
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Fabio Collini
 
PDF
Grammarware Memes
Eelco Visser
 
PDF
Barcelona.pm Curs1211 sess01
Javier Arturo Rodríguez
 
PDF
Using Templates to Achieve Awesomer Architecture
Garann Means
 
KEY
Crazy things done on PHP
Taras Kalapun
 
PPTX
jQuery
Jay Poojara
 
PDF
[Swift] Memento
Bill Kim
 
PPTX
jQuery
Julie Iskander
 
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
Fabio Collini
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
e-Legion
 
jQuery1.2.cheatsheet.v1.0
guest644d1d
 
Delivering a Responsive UI
Rebecca Murphey
 
Intro programacion funcional
NSCoder Mexico
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Fabio Collini
 
Grammarware Memes
Eelco Visser
 
Barcelona.pm Curs1211 sess01
Javier Arturo Rodríguez
 
Using Templates to Achieve Awesomer Architecture
Garann Means
 
Crazy things done on PHP
Taras Kalapun
 
jQuery
Jay Poojara
 
[Swift] Memento
Bill Kim
 

Similar to DeprecatedAPI로 알아보는 SwiftUI (19)

PDF
Session 210 _accessibility_for_ios
cheinyeanlim
 
PDF
Minimizing Decision Fatigue to Improve Team Productivity
Derek Lee
 
PDF
iOS API Design
Brian Gesiak
 
PDF
Introducing PanelKit
Louis D'hauwe
 
PDF
How to: Accessible iPhone/iPad apps that the blind can use with Rubymotion
Italianlabel
 
PDF
Ruby motion and-ios-accessibility
Martino Branding
 
PDF
Object-oriented vs protocol-oriented, czyli o tym jak przełożyć skomplikowany...
The Software House
 
PDF
Let's migrate to Swift 3.0
CocoaHeads France
 
PDF
SwiftUI and Combine All the Things
Scott Gardner
 
PDF
(Even more) Rapid App Development with RubyMotion
Stefan Haflidason
 
PDF
Programming iOS 14 11th Edition Matt Neuburg
mouinarefin
 
PDF
Beyond VoiceOver: making iOS apps accessible
Sally Shepard
 
PDF
Gestures
SV.CO
 
PDF
iOS Accessibility Testing Workshop
Sally Shepard
 
PDF
Andrey Khlopotin accessibility iOS
Wey Wey Web
 
PDF
Cocoaheads
Benjamin Pisano
 
PDF
Hidden Gems in Swift
Netguru
 
PPTX
Learnings for Accessibility for iOS Platform
Tasneem Sayeed
 
PDF
Debugging Accessibility @ Craft Conf
Sally Shepard
 
Session 210 _accessibility_for_ios
cheinyeanlim
 
Minimizing Decision Fatigue to Improve Team Productivity
Derek Lee
 
iOS API Design
Brian Gesiak
 
Introducing PanelKit
Louis D'hauwe
 
How to: Accessible iPhone/iPad apps that the blind can use with Rubymotion
Italianlabel
 
Ruby motion and-ios-accessibility
Martino Branding
 
Object-oriented vs protocol-oriented, czyli o tym jak przełożyć skomplikowany...
The Software House
 
Let's migrate to Swift 3.0
CocoaHeads France
 
SwiftUI and Combine All the Things
Scott Gardner
 
(Even more) Rapid App Development with RubyMotion
Stefan Haflidason
 
Programming iOS 14 11th Edition Matt Neuburg
mouinarefin
 
Beyond VoiceOver: making iOS apps accessible
Sally Shepard
 
Gestures
SV.CO
 
iOS Accessibility Testing Workshop
Sally Shepard
 
Andrey Khlopotin accessibility iOS
Wey Wey Web
 
Cocoaheads
Benjamin Pisano
 
Hidden Gems in Swift
Netguru
 
Learnings for Accessibility for iOS Platform
Tasneem Sayeed
 
Debugging Accessibility @ Craft Conf
Sally Shepard
 
Ad

More from Bongwon Lee (8)

PDF
Swift in SwiftUI
Bongwon Lee
 
PDF
App Lifecycle
Bongwon Lee
 
PDF
GraphQL over REST
Bongwon Lee
 
PDF
The Sandbox Container Directory
Bongwon Lee
 
PDF
Simulator customizing & testing for Xcode 9
Bongwon Lee
 
PDF
LetSwift 2017 - ARKit
Bongwon Lee
 
PDF
Realm, Mobile Database
Bongwon Lee
 
PDF
Custom Xcode Template (with VIPER)
Bongwon Lee
 
Swift in SwiftUI
Bongwon Lee
 
App Lifecycle
Bongwon Lee
 
GraphQL over REST
Bongwon Lee
 
The Sandbox Container Directory
Bongwon Lee
 
Simulator customizing & testing for Xcode 9
Bongwon Lee
 
LetSwift 2017 - ARKit
Bongwon Lee
 
Realm, Mobile Database
Bongwon Lee
 
Custom Xcode Template (with VIPER)
Bongwon Lee
 
Ad

Recently uploaded (20)

PDF
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
UI5con_2025_Accessibility_Ever_Evolving_
gerganakremenska1
 
PDF
Best Web development company in india 2025
Greenusys
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
PDF
NPD Software -Omnex systems
omnex systems
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PDF
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
Is Framer the Future of AI Powered No-Code Development?
Isla Pandora
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
Why is partnering with a SaaS development company crucial for enterprise succ...
Nextbrain Technologies
 
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
UI5con_2025_Accessibility_Ever_Evolving_
gerganakremenska1
 
Best Web development company in india 2025
Greenusys
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
NPD Software -Omnex systems
omnex systems
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Is Framer the Future of AI Powered No-Code Development?
Isla Pandora
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Why is partnering with a SaaS development company crucial for enterprise succ...
Nextbrain Technologies
 

DeprecatedAPI로 알아보는 SwiftUI

  • 3. Accessibility APIs navigationBarTitle(_:) edgesIgnoringSafeArea(_:) colorScheme(_:) contextMenu(_:) navigationBarItems(_:) Drag & Drop UTI (String) navigationTitle(_:) navigationBarTitleDisplayMode(_:) ignoresSafeArea(_:edges:) preferredColorScheme(_:) contextMenu(menuItems:) toolbar(content:) Drag & Drop UTI (UTType)
  • 5. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ... }
  • 6. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ... }
  • 7. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ... }
  • 8. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") @available(watchOS, introduced: 6, deprecated: 100000.0, renamed: "accessibilityHidden(_:)") func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ... } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { func accessibilityHidden(_ hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityLabel(_ label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityValue(_ value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityHint(_ hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ... }
  • 13. min(number1, number2) zip(sequence1, sequence2) UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535 UInt16(bigEndian: 123) // 123 -> 31488 UInt32(someUInt16number) Int64(someInt8number)
  • 14. min(number1, number2) zip(sequence1, sequence2) UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535 UInt16(bigEndian: 123) // 123 -> 31488 UInt32(someUInt16number) Int64(someInt8number)
  • 15. min(number1, number2) zip(sequence1, sequence2) func trimmedPath(from: CGFloat, to: CGFloat) -> Path func move(to p: CGPoint) UInt16(truncating: NSNumber(value: UInt32.max)) // 4294967295 -> 65535 UInt16(bigEndian: 123) // 123 -> 31488 UInt32(someUInt16number) Int64(someInt8number)
  • 17. func addSubview(_ view: UIView) func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
  • 18. func addSubview(_ view: UIView) func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
  • 19. func addSubview(_ view: UIView) func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle func add(Subview view: UIView)
  • 20. func addSubview(_ view: UIView) func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ⛔ func add(Subview view: UIView)
  • 21. func addSubview(_ view: UIView) func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle func accessibilityHidden(_ hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityLabel(_ label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityValue(_ value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibilityHint(_ hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ✅ func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier> ⛔ func add(Subview view: UIView)
  • 22. Slider(value: $opacity) { Text("Slider") } .accessibilityLabel("Opacity slider") .accessibilityAction(.escape) { opacity = 0.0 } .accessibilityAction(.magicTap) { opacity = 1.0 } .accessibilityAdjustableAction { direction in switch direction { case .increment: opacity += 0.05 case .decrement: opacity -= 0.05 default: break } }
  • 23. Slider(value: $opacity) { Text("Slider") } .accessibilityLabel("Opacity slider") .accessibilityAction(.escape) { opacity = 0.0 } .accessibilityAction(.magicTap) { opacity = 1.0 } .accessibilityAdjustableAction { direction in switch direction { case .increment: opacity += 0.05 case .decrement: opacity -= 0.05 default: break } }
  • 24. Slider(value: $opacity) { Text("Slider") } .accessibilityLabel("Opacity slider") .accessibilityAction(.escape) { opacity = 0.0 } .accessibilityAction(.magicTap) { opacity = 1.0 } .accessibilityAdjustableAction { direction in switch direction { case .increment: opacity += 0.05 case .decrement: opacity -= 0.05 default: break } }
  • 25. Slider(value: $opacity) { Text("Slider") } .accessibilityLabel("Opacity slider") .accessibilityAction(.escape) { opacity = 0.0 } .accessibilityAction(.magicTap) { opacity = 1.0 } .accessibilityAdjustableAction { direction in switch direction { case .increment: opacity += 0.05 case .decrement: opacity -= 0.05 default: break } }
  • 26. Image(decorative: "SwiftUI") .opacity(opacity) Text("SwiftUI Logo Image") .font(.caption) .opacity(opacity) .onTapGesture { opacity += 0.1 } .accessibilityValue("Opacity (opacity, specifier: "%.2f")") .accessibilityAddTraits(.isButton) .accessibilityScrollAction { (edge) in switch edge { case .top: opacity -= 0.5 case .bottom: opacity += 0.5 case .leading: opacity -= 0.2 case .trailing: opacity += 0.2 } }
  • 27. Image(decorative: "SwiftUI") .opacity(opacity) Text("SwiftUI Logo Image") .font(.caption) .opacity(opacity) .onTapGesture { opacity += 0.1 } .accessibilityValue("Opacity (opacity, specifier: "%.2f")") .accessibilityAddTraits(.isButton) .accessibilityScrollAction { (edge) in switch edge { case .top: opacity -= 0.5 case .bottom: opacity += 0.5 case .leading: opacity -= 0.2 case .trailing: opacity += 0.2 } }
  • 28. Image(decorative: "SwiftUI") .opacity(opacity) Text("SwiftUI Logo Image") .font(.caption) .opacity(opacity) .onTapGesture { opacity += 0.1 } .accessibilityValue("Opacity (opacity)") .accessibilityAddTraits(.isButton) .accessibilityScrollAction { (edge) in switch edge { case .top: opacity -= 0.5 case .bottom: opacity += 0.5 case .leading: opacity -= 0.2 case .trailing: opacity += 0.2 } }
  • 29. Image(decorative: "SwiftUI") .opacity(opacity) Text("SwiftUI Logo Image") .font(.caption) .opacity(opacity) .onTapGesture { opacity += 0.1 } .accessibilityValue("Opacity (opacity, specifier: "%.2f")") .accessibilityAddTraits(.isButton) .accessibilityScrollAction { (edge) in switch edge { case .top: opacity -= 0.5 case .bottom: opacity += 0.5 case .leading: opacity -= 0.2 case .trailing: opacity += 0.2 } }
  • 30. Image(decorative: "SwiftUI") .opacity(opacity) Text("SwiftUI Logo Image") .font(.caption) .opacity(opacity) .onTapGesture { opacity += 0.1 } .accessibilityValue("Opacity (opacity, specifier: "%.2f")") .accessibilityAddTraits(.isButton) .accessibilityScrollAction { (edge) in switch edge { case .top: opacity -= 0.5 case .bottom: opacity += 0.5 case .leading: opacity -= 0.2 case .trailing: opacity += 0.2 } }
  • 32. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View }
  • 33. @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(watchOS, introduced: 6.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") extension View { func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View }
  • 34. @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") @available(watchOS, introduced: 6.0, deprecated: 100000.0, message: "Use ignoresSafeArea(_:edges:) instead.") extension View { func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { func ignoresSafeArea(_ regions: SafeAreaRegions = .all, edges: Edge.Set = .all) -> some View }
  • 36. [ ignore (.all) ][ 미적용 ]
  • 37. [ ignore (.all) ][ 미적용 ] [ ignore (.keyboard) ]
  • 38. [ ignore (.all) ] [ ignore (.container) ][ 미적용 ] [ ignore (.keyboard) ]
  • 39. [ .top ][ 미적용 ]
  • 40. [ .top ][ 미적용 ] [ .top, .bottom ]
  • 41. [ .top ] [ .bottom ][ 미적용 ] [ .top, .bottom ]
  • 44. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { func colorScheme(_ colorScheme: ColorScheme) -> some View }
  • 45. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") func colorScheme(_ colorScheme: ColorScheme) -> some View }
  • 46. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") func colorScheme(_ colorScheme: ColorScheme) -> some View } SomeView() .colorScheme(.dark) SomeView() .environment(.colorScheme, .dark)
  • 47. @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(macOS, introduced: 10.15, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "preferredColorScheme(_:)") func colorScheme(_ colorScheme: ColorScheme) -> some View } @available(iOS 13.0, macOS 11.0, tvOS 13.0, watchOS 6.0, *) extension View { func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View }
  • 52. @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) @available(macOS, unavailable) extension View { func navigationBarTitle(_ title: Text) -> some View func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View func navigationBarTitle<S>(_ title: S) -> some View where S : StringProtocol func navigationBarTitle(_ title: Text, displayMode: NavigationBarItem.TitleDisplayMode) -> some View ... }
  • 53. @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) @available(macOS, unavailable) extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)") @available(macOS, unavailable) @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)") @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)") func navigationBarTitle(_ title: Text) -> some View func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View func navigationBarTitle<S>(_ title: S) -> some View where S : StringProtocol @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use navigationTitle(_:) with navigationBarTitleDisplayMode(_:)") func navigationBarTitle(_ title: Text, displayMode: NavigationBarItem.TitleDisplayMode) -> some View ... }
  • 54. @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { func navigationTitle(_ title: Text) -> some View func navigationTitle(_ titleKey: LocalizedStringKey) -> some View func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol }
  • 55. @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { func navigationTitle(_ title: Text) -> some View func navigationTitle(_ titleKey: LocalizedStringKey) -> some View func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol } @available(iOS 14.0, *) @available(macOS, unavailable) @available(tvOS, unavailable) @available(watchOS, unavailable) extension View { func navigationBarTitleDisplayMode(_ displayMode: NavigationBarItem.TitleDisplayMode) -> some View }
  • 57. NavigationView { Text("Deprecated APIs Example") .navigationTitle("Inline Mode Title") .navigationBarTitleDisplayMode(.inline) } NavigationView { Text("Deprecated APIs Example") .navigationTitle("Large Mode Title") .navigationBarTitleDisplayMode(.large) } [ inline ] [ large ]
  • 58. #if os(macOS) extension View { func navigationBarTitle<S>(_ title: S) -> some View where S: StringProtocol { self } func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View { self } func navigationBarTitle(_ title: Text) -> some View { self } } #endif
  • 60. extension View { @available(iOS 13.0, tvOS 13.0, *) @available(macOS, unavailable) @available(watchOS, unavailable) func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View func navigationBarItems<L>(leading: L) -> some View where L : View func navigationBarItems<T>(trailing: T) -> some View where T : View }
  • 61. extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading or navigationBarTrailing placement") @available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading or navigationBarTrailing placement") @available(macOS, unavailable) @available(watchOS, unavailable) func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View func navigationBarItems<L>(leading: L) -> some View where L : View func navigationBarItems<T>(trailing: T) -> some View where T : View }
  • 62. extension View { @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading or navigationBarTrailing placement") @available(tvOS, introduced: 13.0, deprecated: 100000.0, message: "Use toolbar(_:) with navigationBarLeading or navigationBarTrailing placement") @available(macOS, unavailable) @available(watchOS, unavailable) func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View func navigationBarItems<L>(leading: L) -> some View where L : View func navigationBarItems<T>(trailing: T) -> some View where T : View } @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) extension View { func toolbar<Content>(@ViewBuilder content: () -> Content) -> some View where Content : View func toolbar<Content>(@ToolbarContentBuilder content: () -> Content) -> some View where Content : ToolbarContent func toolbar<Content>(id: String, @ToolbarContentBuilder content: () -> Content) -> some View where Content : CustomizableToolbarContent }
  • 63. var body: some View { NavigationView { Image("SwiftUI") .navigationBarItems(leading: leadingItem, trailing: trailingItem) .navigationBarTitle("NavigationBarItems") } } var leadingItem: some View { Button(action: { print("Leading Item") }) { Image(systemName: "bell") } } var trailingItem: some View { HStack { Button(action: { print("Trailing Item 1") }) { Image(systemName: "square.and.arrow.up") } Button(action: { print("Trailing Item 2") }) { Image(systemName: "gear") } } }
  • 64. NavigationView { Image("SwiftUI") .navigationTitle("Toolbar") .toolbar { HStack { Button(action: { print("Toolbar Item 1") }) { Image(systemName: "square.and.arrow.up") } Button(action: { print("Toolbar Item 2") }) { Image(systemName: "gear") } } } }
  • 65. .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button(action: { print("Leading Item") }) { Image(systemName: "bell") } } ToolbarItem(placement: .navigationBarTrailing) { HStack { Button(action: { print("Trailing Item 1") }) { Image(systemName: "square.and.arrow.up") } Button(action: { print("Trailing Item 2") }) { Image(systemName: "gear") } } } }
  • 67. NavigationView { Text("Toolbar Action") .font(.title) .toolbar { ToolbarItem(placement: .destructiveAction) { Button("Delete", action: { presentation.wrappedValue.dismiss() }) } ToolbarItem(placement: .confirmationAction) { Button("Confirm", action: { presentation.wrappedValue.dismiss() }) } ToolbarItem(placement: .cancellationAction) { Button("Cancel", action: { presentation.wrappedValue.dismiss() }) } } }
  • 70. [ .principal (inlineMode) ][ .principal (largeMode) ]
  • 71. [ .navigation (+ backButton) ][ .navigation ]
  • 72. [ .navigation (+ backButton) ][ .navigation ]
  • 75. var body: some Scene { WindowGroup { ContentView() } .commands { ToolbarCommands() } }
  • 78. @available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 14.0, *) extension View { func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View } @available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 14.0, *) extension View { func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View }
  • 79. @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use `contextMenu(menuItems:)` instead.") @available(macOS, introduced: 10.15, deprecated: 100000.0, message: "Use `contextMenu(menuItems:)` instead.") @available(tvOS, unavailable) @available(watchOS, introduced: 6.0, deprecated: 7.0) extension View { func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View } @available(iOS 13.0, macOS 10.15, tvOS 14.0, *) @available(watchOS, introduced: 6.0, deprecated: 7.0) extension View { func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View }
  • 80. var body: some View { let contextMenu = ContextMenu { Button(" ") { print(" ...") } Button(" ") { print(" ...") } Button(" ") { print(" ...") } } return Text(" ") .foregroundColor(.white) .padding(10) .background(Color.green.cornerRadius(10)) .contextMenu(contextMenu) }
  • 81. var body: some View { Text(" ") .foregroundColor(.white) .padding(10) .background(Color.green.cornerRadius(10)) .contextMenu { Button(" ") { print(" ...") } Button(" ") { print(" ...") } Button(" ") { print(" ...") } } }
  • 82. var body: some View { Menu(" ") { Button(" ") { print(" ...") } Button(" ") { print(" ...") } Button(" ") { print(" ...") } } .foregroundColor(.white) .padding(10) .background(Color.green.cornerRadius(10)) }
  • 86. extension DropInfo { func hasItemsConforming(to types: [String]) -> Bool func itemProviders(for types: [String]) -> [NSItemProvider] } extension View { func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View } extension DynamicViewContent { func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) -> Void) -> some DynamicViewContent }
  • 87. extension DropInfo { func hasItemsConforming(to types: [String]) -> Bool func itemProviders(for types: [String]) -> [NSItemProvider] } extension View { func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View } extension DynamicViewContent { func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) -> Void) -> some DynamicViewContent }
  • 88. extension DropInfo { func hasItemsConforming(to types: [String]) -> Bool func itemProviders(for types: [String]) -> [NSItemProvider] } extension View { func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View } extension DynamicViewContent { func onInsert(of acceptedTypeIdentifiers: [String], perform action: @escaping (Int, [NSItemProvider]) -> Void) -> some DynamicViewContent }
  • 89. struct DropInfo { func hasItemsConforming(to contentTypes: [UTType]) -> Bool func itemProviders(for contentTypes: [UTType]) -> [NSItemProvider] } extension View { func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View func onDrop(of supportedContentTypes: [UTType], delegate: DropDelegate) -> some View } extension DynamicViewContent { func onInsert(of supportedContentTypes: [UTType], perform action: @escaping (Int, [NSItemProvider]) -> Void) -> some DynamicViewContent }
  • 90. struct ImageDroppableView: View { let imageNames = ["cat1", "cat2", "dog1", "dog2"] var body: some View { VStack { HStack { ForEach(imageNames, id: .self) { imageName -> AnyView in let imageURL = Bundle.main.url(forResource: imageName, withExtension: "jpg")! return AnyView( Image(nsImage: NSImage(byReferencing: imageURL)) .resizable() .aspectRatio(3/2, contentMode: .fit) .onDrag { NSItemProvider(object: imageURL as NSURL) } ) } } DropZone() } } }
  • 91. struct ImageDroppableView: View { let imageNames = ["cat1", "cat2", "dog1", "dog2"] var body: some View { VStack { HStack { ForEach(imageNames, id: .self) { imageName -> AnyView in let imageURL = Bundle.main.url(forResource: imageName, withExtension: "jpg")! return AnyView( Image(nsImage: NSImage(byReferencing: imageURL)) .resizable() .aspectRatio(3/2, contentMode: .fit) .onDrag { NSItemProvider(object: imageURL as NSURL) } ) } } DropZone() } } }
  • 92. struct DropZone: View { @State private var isTargeted = false @State private var image: NSImage? = nil var body: some View { Rectangle() .fill(isTargeted ? Color.green : Color.secondary) .overlay(Text("Drop Zone").font(.largeTitle)) .overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit()) .onDrop(of: ["public.file-url"], isTargeted: $isTargeted, perform: { items in guard let item = items.first else { return false } item.loadItem(forTypeIdentifier: "public.file-url") { (data, error) in if let urlData = data as? Data, let url = URL(dataRepresentation: urlData, relativeTo: nil) { image = NSImage(byReferencing: url) } } return true }) } }
  • 93. struct DropZone: View { @State private var isTargeted = false @State private var image: NSImage? = nil var body: some View { Rectangle() .fill(isTargeted ? Color.green : Color.secondary) .overlay(Text("Drop Zone").font(.largeTitle)) .overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit()) .onDrop(of: ["public.file-url"], isTargeted: $isTargeted, perform: { items in guard let item = items.first else { return false } item.loadItem(forTypeIdentifier: "public.file-url") { (data, error) in if let urlData = data as? Data, let url = URL(dataRepresentation: urlData, relativeTo: nil) { image = NSImage(byReferencing: url) } } return true }) } }
  • 94. struct DropZone: View { @State private var isTargeted = false @State private var image: NSImage? = nil var body: some View { Rectangle() .fill(isTargeted ? Color.green : Color.secondary) .overlay(Text("Drop Zone").font(.largeTitle)) .overlay(Image(nsImage: image ?? NSImage()).resizable().scaledToFit()) .onDrop(of: [.fileURL], isTargeted: $isTargeted, perform: { items in guard let item = items.first else { return false } item.loadItem(forTypeIdentifier: UTType.fileURL.identifier) { (data, error) in if let urlData = data as? Data, let url = URL(dataRepresentation: urlData, relativeTo: nil) { image = NSImage(byReferencing: url) } } return true }) } } import UniformTypeIdentifiers
  • 96. Accessibility APIs navigationBarTitle(_:) edgesIgnoringSafeArea(_:) colorScheme(_:) contextMenu(_:) navigationBarItems(_:) Drag & Drop UTI (String) navigationTitle(_:) navigationBarTitleDisplayMode(_:) ignoresSafeArea(_:edges:) preferredColorScheme(_:) contextMenu(menuItems:) toolbar(content:) Drag & Drop UTI (UTType)