-
Meet UIKit for spatial computing
Learn how to bring your UIKit app to visionOS. We'll show you how to build for a new destination, explore APIs and best practices for spatial computing, and take your content into the third dimension when you use SwiftUI with UIKit in visionOS.
Capítulos
- 1:35 - Getting started
- 2:56 - Platform differences
- 5:36 - Polishing your app
- 5:52 - Polish: Colors
- 10:20 - Polish: Hover
- 12:12 - Polish: Input
- 13:47 - Outside the bounds
- 15:03 - Outside: Presentations
- 17:11 - Outside: Ornaments
- 21:51 - Outside: RealityKit
Recursos
Videos relacionados
WWDC23
-
Buscar este video…
-
-
16:15 - permittedArrowDirections
import UIKit extension EditorViewController { @objc func showDocumentPopover(sender: UIBarButtonItem) { let controller = DocumentInfoViewController(document: pixelDocument) controller.modalPresentationStyle = .popover if let presentationController = controller.popoverPresentationController { presentationController.barButtonItem = sender if traitCollection.userInterfaceIdiom == .reality { presentationController.permittedArrowDirections = .any } else { presentationController.permittedArrowDirections = .right } } present(controller, animated: true, completion: nil) } } -
19:46 - Ornament
extension EditorViewController { func showEditingControlsOrnament() { let ornament = UIHostingOrnament(sceneAlignment: .bottom, contentAlignment: .center) { EditingControlsView(model: controlsViewModel) .glassBackgroundEffect() } self.ornaments = [ornament] editorView.style = .edgeToEdge } } -
22:45 - UIHostingController
extension EditorViewController { func showEntityPreview() { let entityView = PixelArtEntityView(model: entityViewModel) let controller = UIHostingController(rootView: entityView) addChild(controller) view.addSubview(controller.view) controller.didMove(toParent: self) prepareEditorInteractions() } } -
22:46 - Using Semantic Colors
private let titleLabelTextField: UITextField = { textField.textColor = UIColor.label return textField }() private let authorLabel: UILabel = { label.textColor = UIColor.secondaryLabel return label }() -
22:47 - Adding a recessed appearance to a text field
textField.borderStyle = .roundedRect -
22:48 - Overriding preferredContainerBackgroundStyle
class MyViewController: UIViewController { override var preferredContainerBackgroundStyle: UIContainerBackgroundStyle { return .glass } } -
22:49 - Customizing hover style
class CollectionViewCell: UICollectionViewCell { init(document: PixelArtDocument) { self.hoverStyle = .init( effect: .highlight, shape: .roundedRect(cornerRadius: 8.0)) } } -
22:50 - Checking user interface idiom
func fourFingerSwipe() { let gesture = UISwipeGestureRecognizer( target: self, action: #selector(self.deleteAll)) gesture.direction = .left if traitCollection.userInterfaceIdiom == .reality { gesture.numberOfTouchesRequired = 2 } else { gesture.numberOfTouchesRequired = 4 } self.view.addGestureRecognizer(gesture) }
-