SlideShare a Scribd company logo
Accessibility APIs
navigationBarTitle(_:)
edgesIgnoringSafeArea(_:)
colorScheme(_:)
contextMenu(_:)
navigationBarItems(_:)
Drag & Drop UTI (String)
navigationTitle(_:)


navigationBarTitleDisplayMode(_:)
ignoresSafeArea(_:edges:)
preferredColorScheme(_:)
contextMenu(menuItems:)
toolbar(content:)
Drag & Drop UTI (UTType)
@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>


...


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


}


}
@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


}
[ ignore (.all) ][ 미적용 ]
[ ignore (.all) ][ 미적용 ] [ ignore (.keyboard) ]
[ ignore (.all) ] [ ignore (.container) ][ 미적용 ] [ ignore (.keyboard) ]
[ .top ][ 미적용 ]
[ .top ][ 미적용 ] [ .top, .bottom ]
[ .top ] [ .bottom ][ 미적용 ] [ .top, .bottom ]
@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


}
@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


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


}


}


}


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


}


}


}
[ .principal (inlineMode) ][ .principal (largeMode) ]
[ .navigation (+ backButton) ][ .navigation ]
[ .navigation (+ backButton) ][ .navigation ]
var body: some Scene {


WindowGroup {


ContentView()


}


.commands {


ToolbarCommands()


}


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

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

From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFrom Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
Fabio Collini
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»e-Legion
 
jQuery1.2.cheatsheet.v1.0
jQuery1.2.cheatsheet.v1.0jQuery1.2.cheatsheet.v1.0
jQuery1.2.cheatsheet.v1.0guest644d1d
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UIRebecca Murphey
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
NSCoder Mexico
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFrom java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Fabio Collini
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
Eelco Visser
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
Garann Means
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
[Swift] Memento
[Swift] Memento[Swift] Memento
[Swift] Memento
Bill Kim
 
jQuery
jQueryjQuery

What's hot (13)

From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFrom Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf Milan
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»
 
jQuery1.2.cheatsheet.v1.0
jQuery1.2.cheatsheet.v1.0jQuery1.2.cheatsheet.v1.0
jQuery1.2.cheatsheet.v1.0
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFrom java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHP
 
jQuery
jQueryjQuery
jQuery
 
[Swift] Memento
[Swift] Memento[Swift] Memento
[Swift] Memento
 
jQuery
jQueryjQuery
jQuery
 

Similar to DeprecatedAPI로 알아보는 SwiftUI

Swift 함수 커링 사용하기
Swift 함수 커링 사용하기Swift 함수 커링 사용하기
Swift 함수 커링 사용하기
진성 오
 
Miracle of std lib
Miracle of std libMiracle of std lib
Miracle of std lib
Jedsada Tiwongvokul
 
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kirill Rozov
 
Kotlin Advanced - Apalon Kotlin Sprint Part 3
Kotlin Advanced - Apalon Kotlin Sprint Part 3Kotlin Advanced - Apalon Kotlin Sprint Part 3
Kotlin Advanced - Apalon Kotlin Sprint Part 3
Kirill Rozov
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
John De Goes
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수
용 최
 
Managing parallelism using coroutines
Managing parallelism using coroutinesManaging parallelism using coroutines
Managing parallelism using coroutines
Fabio Collini
 
미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정
SeungChul Kang
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
Chris Bailey
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
Movel
 
Implementing pseudo-keywords through Functional Programing
Implementing pseudo-keywords through Functional ProgramingImplementing pseudo-keywords through Functional Programing
Implementing pseudo-keywords through Functional Programing
Vincent Pradeilles
 
{"JSON, Swift and Type Safety" : "It's a wrap"}
{"JSON, Swift and Type Safety" : "It's a wrap"}{"JSON, Swift and Type Safety" : "It's a wrap"}
{"JSON, Swift and Type Safety" : "It's a wrap"}
Anthony Levings
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
Łukasz Bałamut
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
Michele Titolo
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomerzefhemel
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212
Mahmoud Samir Fayed
 

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

Swift 함수 커링 사용하기
Swift 함수 커링 사용하기Swift 함수 커링 사용하기
Swift 함수 커링 사용하기
 
Miracle of std lib
Miracle of std libMiracle of std lib
Miracle of std lib
 
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2
 
Kotlin Advanced - Apalon Kotlin Sprint Part 3
Kotlin Advanced - Apalon Kotlin Sprint Part 3Kotlin Advanced - Apalon Kotlin Sprint Part 3
Kotlin Advanced - Apalon Kotlin Sprint Part 3
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수
 
Managing parallelism using coroutines
Managing parallelism using coroutinesManaging parallelism using coroutines
Managing parallelism using coroutines
 
미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
Implementing pseudo-keywords through Functional Programing
Implementing pseudo-keywords through Functional ProgramingImplementing pseudo-keywords through Functional Programing
Implementing pseudo-keywords through Functional Programing
 
{"JSON, Swift and Type Safety" : "It's a wrap"}
{"JSON, Swift and Type Safety" : "It's a wrap"}{"JSON, Swift and Type Safety" : "It's a wrap"}
{"JSON, Swift and Type Safety" : "It's a wrap"}
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212
 

More from Bongwon Lee

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

More from Bongwon Lee (8)

Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
 
App Lifecycle
App LifecycleApp Lifecycle
App Lifecycle
 
GraphQL over REST
GraphQL over RESTGraphQL over REST
GraphQL over REST
 
The Sandbox Container Directory
The Sandbox Container DirectoryThe Sandbox Container Directory
The Sandbox Container Directory
 
Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9
 
LetSwift 2017 - ARKit
LetSwift 2017 - ARKitLetSwift 2017 - ARKit
LetSwift 2017 - ARKit
 
Realm, Mobile Database
Realm, Mobile DatabaseRealm, Mobile Database
Realm, Mobile Database
 
Custom Xcode Template (with VIPER)
Custom Xcode Template (with VIPER)Custom Xcode Template (with VIPER)
Custom Xcode Template (with VIPER)
 

Recently uploaded

Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 

Recently uploaded (20)

Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 

DeprecatedAPI로 알아보는 SwiftUI

  • 1.
  • 2.
  • 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)
  • 4.
  • 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> ... }
  • 9.
  • 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)
  • 16.
  • 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 } }
  • 31.
  • 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 }
  • 35.
  • 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 ]
  • 42.
  • 43.
  • 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 }
  • 48.
  • 49.
  • 50.
  • 51.
  • 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 }
  • 56.
  • 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
  • 59.
  • 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") } } } }
  • 66.
  • 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() }) } } }
  • 68.
  • 69.
  • 70. [ .principal (inlineMode) ][ .principal (largeMode) ]
  • 71. [ .navigation (+ backButton) ][ .navigation ]
  • 72. [ .navigation (+ backButton) ][ .navigation ]
  • 73.
  • 74.
  • 75. var body: some Scene { WindowGroup { ContentView() } .commands { ToolbarCommands() } }
  • 76.
  • 77.
  • 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)) }
  • 83.
  • 84.
  • 85.
  • 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
  • 95.
  • 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)