Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS 17 Programming for Beginners

You're reading from   iOS 17 Programming for Beginners Unlock the world of iOS development with Swift 5.9, Xcode 15, and iOS 17 – your path to App Store success

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781837630561
Length 604 pages
Edition 8th Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Ian Lockett Ian Lockett
Author Profile Icon Ian Lockett
Ian Lockett
Ahmad Sahar Ahmad Sahar
Author Profile Icon Ahmad Sahar
Ahmad Sahar
Arrow right icon
View More author details
Toc

Table of Contents (34) Chapters Close

Preface 1. Part 1: Swift
2. Exploring Xcode FREE CHAPTER 3. Simple Values and Types 4. Conditionals and Optionals 5. Range Operators and Loops 6. Collection Types 7. Functions and Closures 8. Classes, Structures, and Enumerations 9. Protocols, Extensions, and Error Handling 10. Swift Concurrency 11. Part 2: Design
12. Setting Up the User Interface 13. Building Your User Interface 14. Finishing Up Your User Interface 15. Modifying App Screens 16. Part 3: Code
17. Getting Started with MVC and Table Views 18. Getting Data into Table Views 19. Passing Data between View Controllers 20. Getting Started with Core Location and MapKit 21. Getting Started with JSON Files 22. Getting Started with Custom Views 23. Getting Started with the Camera and Photo Library 24. Getting Started with Search 25. Getting Started with Collection Views 26. Part 4: Features
27. Getting Started with SwiftData 28. Getting Started with SwiftUI 29. Getting Started with Widgets 30. Getting Started with visionOS 31. Testing and Submitting Your App to the App Store 32. Other Books You May Enjoy
33. Index

Adding 3D objects to your app

You have updated your app’s appearance, and it looks great on visionOS. Now, you’ll add a 3D model to your app. To do so, you’ll combine SwiftUI and UIKit together to load and display a 3D model on the Map screen.

Follow these steps:

  1. The SketchFab website (https://sketchfab.com/) has many 3D models available for download. Search for and download a USDZ 3D model of Earth. For example, you can download one made by matousekfbto from this link: https://sketchfab.com/3d-models/earth-globe-98d2b04d46474bafb4250cc75dc583b3.
  2. Rename the downloaded file globe.usdz and drag it to the Model group in your project:

Figure 26.14: Navigator area showing globe.usdz

  1. In the Project navigator, right-click the Views group and add a new SwiftUI View file named GlobeView to it. Modify its contents as shown:
    import SwiftUI
    import RealityKit
    struct GlobeView: View {
      var body: some View {
        #if os...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime