A view that displays a root view and enables you to present additional views over the root view.
A view that displays a root view and enables you to present additional views over the root view.
NavigationLink(destination: {
Text("Screen 2")
}, label: {
Text("Click me")
})
.navigationTitle("Hello, World")
NavigationLink
, It only move up and back on stack only
When it’s under NavigationStack
, it can moves up and down freely.
struct MySecondScreen: View {
let value: Int
init(value: Int) {
self.value = value
print("INIT SCREEN: \(value)")
}
var body: some View {
Text("Screen \(value)")
}
}
Text will show screen # and when the view is initialized, it will print the which screen # got called
NavigationSplitView {
ScrollView {
VStack(spacing: 20) {
ForEach(0..<10) { x in
NavigationLink(destination: MySecondScreen(value: x)) {
Text("Click me")
}
}
}
.navigationTitle("Hello, World")
}
} detail: {
Model3D(named: "Scene", bundle: realityKitContentBundle)
.padding(.bottom, 50)
}
This is a Swift code snippet for a SwiftUI application. It creates a split view navigation interface. The primary view contains a scrollable VStack with 10 navigation links, each leading to 'MySecondScreen' and passing a different value from 0 to 9.
The secondary view, or 'detail' view, displays a 3D model named 'Scene' from a RealityKit content bundle, padded at the bottom.
It loads all the screen on the background, if the number is large, it will slow down the app
NavigationSplitView {
ScrollView {
VStack(spacing: 20) {
ForEach(0..<10) { x in
NavigationLink(destination: MySecondScreen(value: x)) {
Text("Click me")
}
}
}
.navigationTitle("Hello, World")
}
} detail: {
Model3D(named: "Scene", bundle: realityKitContentBundle)
.padding(.bottom, 50)
}
NavigationSplitView {
ScrollView {
VStack(spacing: 20) {
ForEach(0..<10) { x in
NavigationLink(value: x){
Text("Click me: \\(x)")
}
}
.navigationDestination(for: Int.self) { value in
MySecondScreen(value: value)
}
.navigationTitle("Hello, World")
}
}
} detail: {
Model3D(named: "Scene", bundle: realityKitContentBundle)
.padding(.bottom, 50)
}
The right one with .navigationDestination
is faster and better to use because it creates the destination view (MySecondScreen
in this case) only when it's needed (i.e., when the associated NavigationLink
is clicked). This is more efficient, especially when dealing with a large number of views or complex views that can slow down the application if all are initialized at once. The left one, without .navigationDestination
, initializes all destination views immediately, which can lead to performance issues.
The SwiftUI .navigationDestination(for:)
modifier is used to create the destination view only when the associated NavigationLink
is clicked. This modifier takes a closure as an argument. This closure is a function that creates the destination view, but it's not called until the NavigationLink
is clicked. This way, not all destination views are created upfront, which saves memory and processing power, and can prevent performance issues in your app.
@State private car stackPath: [String] = []
NavigationStack(path: $stackPath){...}
It will only allow the. destination with the string value
Button("Super Segue") {
stackPath.append(contentsOf: [
"Coconut", "Melon", "Mango"
])
}
When the "Super Segue" button is clicked, the strings "Coconut", "Melon", and "Mango" are added to the stackPath
array. This will cause the NavigationStack
to navigate to these views in the order that they are added.
So, you will first see the "Coconut" view, then if you navigate forward, you'll see the "Melon" view, and finally the "Mango" view.
If you are in the "Mango" view and click the back button, you will navigate back to the "Melon" view since the NavigationStack
maintains a stack-like structure, where the most recently added view is the one you see, and pressing back removes it from the stack and shows the previously added view.
Today, I studied NavigationStack in SwiftUI. It enables navigation between different views in the app. This is achieved through the use of NavigationLink
. The .navigationDestination(for:)
modifier further enhances performance by only creating destination views when necessary. This is particularly beneficial for managing a multitude of complex views.
Today, I examined SwiftUI's NavigationStack. It uses NavigationLink
for view navigation. The .navigationDestination(for:)
modifier boosts efficiency by creating views only when needed, aiding in handling numerous complex views.
#SwiftUI #TodayILearned #AppleVisionPro #visionOS
#iOSDevelopment
#MobileApps
#SwiftLanguage
#AppleDeveloper
#AppDevelopment
#SwiftCode
#iOSProgramming
#iOSApps
#iOSDesign
#SwiftDevelopment #SwiftUIViews #SwiftUINavigation #AppleTech #Xcode #MacOS #AppleDevices #SwiftUICode #SwiftUITutorial #AppleCoding #AppleSoftware
* Are you aware that prior to receiving a job offer with PHSA you must be fully vaccinated against COVID-19 and provide evidence or have an approved exemption from the Provincial Health Officer (PHO)?
Enter a name for your profile (resume) in the Descriptive Title field and select a Job Stream from the drop down list that best represents the type of job you want
Dear Hiring Manager,
I am writing to express my strong interest in the Graphic Designer role at PHSA. With my years of experience and skills in graphic design design, I believe that I am well-suited for this position and can make a valuable contribution to your team.
As you will find on my resume, I have had a variety of experiences with many different roles in graphic design, from my time as a Product Designer at Hong Kong University of Science and Tech to my role as a Graphic Designer at Let's Dive. Throughout these experiences, I have honed my skills in creating responsive UI/UX dashboards, collaborating with development teams, and implementing design elements into functioning prototypes. Additionally, I have gained expertise in utilizing various design tools such as Figma, Adobe Photoshop, and Adobe Illustrator.
One of my most relevant experiences is my time as a Product Designer at Hong Kong University of Science and Tech. During this role, I managed the redesign of the FinSent dashboard with the goal of improving user interaction and engagement. By collaborating closely with the development team, we successfully created a responsive UI/UX dashboard that provides comprehensive information in a modern design. The implementation of design elements into a functioning prototype ensured that the outcomes aligned with project objectives. Furthermore, I developed and implemented a product branding design guideline to facilitate continuous product updates. These experiences have equipped me with the ability to create visually appealing designs while considering user experience and project goals.
Another relevant experience is my tenure as a Graphic Designer at Let's Dive. In this role, I utilized Jitter to create various motion graphics and used Figma for component creation on a newly designed landing page and multiple marketing channels. Through these efforts, I effectively highlighted the product's new AI features and explained its usefulness to potential users. Additionally, I designed marketing graphic assets for blog posts, newsletters, and the website while maintaining consistency with the company's design system. By utilizing Figma, Adobe Photoshop, and Adobe Illustrator, I ensured the development of high-quality marketing materials that effectively communicated the value of the product.
I am confident that my experience in designing responsive UI/UX dashboards and creating visually appealing marketing materials will be highly beneficial in the Graphic Designer role at PHSA. My ability to collaborate closely with cross-functional teams and implement design elements into functioning prototypes aligns with the requirements of this position. I am excited about the opportunity to contribute my skills and expertise to your team and make a positive impact on PHSA.
Thank you for considering my application. I would welcome the opportunity to discuss further how my skills and experiences can bring value to PHSA. I look forward to hearing from you.
Sincerely, Yoon Ro