Close Menu
geekfence.comgeekfence.com
    What's Hot

    Designing trust & safety (T&S) in customer experience management (CXM): why T&S is becoming core to CXM operating model 

    January 24, 2026

    iPhone 18 Series Could Finally Bring Back Touch ID

    January 24, 2026

    The Visual Haystacks Benchmark! – The Berkeley Artificial Intelligence Research Blog

    January 24, 2026
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook Instagram
    geekfence.comgeekfence.com
    • Home
    • UK Tech News
    • AI
    • Big Data
    • Cyber Security
      • Cloud Computing
      • iOS Development
    • IoT
    • Mobile
    • Software
      • Software Development
      • Software Engineering
    • Technology
      • Green Technology
      • Nanotechnology
    • Telecom
    geekfence.comgeekfence.com
    Home»iOS Development»What’s New in SwiftUI for iOS 18
    iOS Development

    What’s New in SwiftUI for iOS 18

    AdminBy AdminJanuary 19, 2026No Comments7 Mins Read1 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    What’s New in SwiftUI for iOS 18
    Share
    Facebook Twitter LinkedIn Pinterest Email


    The world of SwiftUI is constantly evolving, with each update pushing the boundaries of app development. With iOS 18, the enhancements are both exciting and significant, set to transform how developers engage with SwiftUI.

    This guide aims to explore every new feature and improvement in this version, offering a comprehensive overview of the changes.

    The Floating Tab Bar

    The Tab view in SwiftUI has been greatly enhanced with the addition of a floating tab bar. This new feature can seamlessly transition into a sidebar, providing users with an intuitive way to access the full functionality of an app.

    swiftui-tabbar-sidebar.gif

    On iPad, users can now tap a sidebar button on the tab bar to transform the tab bar into sidebar. For developers, it’s just a line of code if you want to support this feature. All you need is to set the tab view style to .sidebarAdaptable:

    struct ContentView: View {
        @State var customization = TabViewCustomization()
        
        var body: some View {
            TabView {
                Tab("Home", systemImage: "house.fill") {
                    
                }
                
                Tab("Bookmark", systemImage: "bookmark.circle.fill") {
                    
                }
                
                Tab("Videos", systemImage: "video.circle.fill") {
                    
                }
                
                Tab("Profile", systemImage: "person.crop.circle") {
                    
                }
                
                Tab("Settings", systemImage: "gear") {
                    
                }
                
            }
            .tint(.yellow)
            .tabViewStyle(.sidebarAdaptable)
            .tabViewCustomization($customization)
        }
    }
    

    Once the option is set, users can effortlessly switch between a sidebar and a tab bar, enhancing navigation flexibility. Additionally, the new tab bar offers extensive customization. By attaching the .tabViewCustomization modifier to the Tab view, users can tailor the menu items of the tab bar.

    Sheet Presentation Sizing

    Sheet presentation sizing is now consistent and streamlined across platforms. By using the .presentationSizing modifier, you can easily create sheets with ideal dimensions using presets such as .form or .page, or even specify custom sizes. Here is a sample:

    struct PresentationSizingDemo: View {
        
        @State private var showSheet = false
        
        var body: some View {
            Button {
                showSheet.toggle()
            } label: {
                Text("Show sheet")
            }
            .sheet(isPresented: $showSheet) {
                Text("This is a quick demo of presentation sizing.")
                    .presentationSizing(.form)
            }
        }
    }
    

    On iPad, the .form preset displays a smaller sheet compared to .page. However, there is no size difference on iPhone.

    swiftui-presentation-sizing.png

    Color Mesh Gradients

    SwiftUI now offers extensive support for colorful mesh gradients. The new MeshGradient feature allows you to create two-dimensional gradients using a grid of positioned colors. By combining control points and colors, you can design a wide variety of gradient effects.

    swiftui-mesh-gradient.png

    Below shows a couple of gradients created using MeshGradient:

    struct ColorMeshDemo: View {
        var body: some View {
            VStack {
                MeshGradient(
                    width: 3,
                    height: 3,
                    points: [
                        .init(0, 0), .init(0.5, 0), .init(1, 0),
                        .init(0, 0.5), .init(0.3, 0.5), .init(1, 0.5),
                        .init(0, 1), .init(0.5, 1), .init(1, 1)
                    ],
                    colors: [
                        .gray, .purple, .indigo,
                        .orange, .cyan, .blue,
                        .yellow, .green, .teal
                    ]
                )
                
                MeshGradient(
                    width: 2,
                    height: 2,
                    points: [
                        .init(0, 0), .init(1, 0),
                        .init(0, 1), .init(1, 1)
                    ],
                    colors: [
                        .red, .purple,
                        .yellow, .green
                    ]
                )
            }
            .ignoresSafeArea()
        }
    }
    
    

    Zoom Transition

    SwiftUI now has the built-in support of zoom transition. You can use the .matchedTransitionSource modifier to easily render the zoom transition.

    swiftui-zoom-transition.gif

    If you’re familiar with using matchedGeometryEffect, you’ll find matchedTransitionSource quite similar. Below is sample code we wrote to create the zoom transition shown above:

    struct ZoomTransitionDemo: View {
        let samplePhotos = (1...20).map { Photo(name: "coffee-\($0)") }
        
        @Namespace() var namespace
        
        var body: some View {
            NavigationStack {
                ScrollView {
                    LazyVGrid(columns: [ GridItem(.adaptive(minimum: 150)) ]) {
                        
                        ForEach(samplePhotos) { photo in
                            NavigationLink {
                                Image(photo.name)
                                    .resizable()
                                    .navigationTransition(.zoom(sourceID: photo.id, in: namespace))
                            } label: {
                                Image(photo.name)
                                    .resizable()
                                    .scaledToFill()
                                    .frame(minWidth: 0, maxWidth: .infinity)
                                    .frame(height: 150)
                                    .cornerRadius(30.0)
                            }
                            .matchedTransitionSource(id: photo.id, in: namespace)
                            
                        }
                    }
                }
            }
            .padding()
        }
    }
    

    The matchedTransitionSource modifier is applied to a NavigationLink with a specific photo ID, designating the view as the source of the navigation transition. For the destination view, which is also an Image view, the navigationTransition modifier is used to render the zoom transition.

    More Animations for SF Symbols 6

    iOS 17 introduced a fantastic collection of expressive animations for SF Symbols. Developers can leverage these animations using the new symbolEffect modifier. iOS 18 pushes the SF Symbols to version 6 with an even wider variety of animated symbols for developers to utilize in their apps.

    swiftui-sfanimation-rotate.gif

    Here is a sample code snippet for the new rotate animation:

    Image(systemName: "ellipsis.message")
                .font(.system(size: 300))
                .symbolRenderingMode(.palette)
                .foregroundStyle(.purple, .gray)
                .symbolEffect(.rotate, value: animate)
                .onTapGesture {
                    animate.toggle()
                }
    

    On top of the rotate animation, SF Symbols 6 also provides two other types of animation including .wiggle and .breathe.

    Enhancements of SwiftUI Charts

    The SwiftUI Charts framework now supports vectorized and function plots. For example, let’s say you want to plot a graph for the following function:

    y = x^2

    You can use LinePlot to plot the graph like this:

    Chart {
        LinePlot(x: "x", y: "y") { x in
            return pow(x, 2)
        }
        .foregroundStyle(.green)
        .lineStyle(.init(lineWidth: 10))
    }
    .chartXScale(domain: -4...4)
    .chartYScale(domain: -4...4)
    .chartXAxis {
        AxisMarks(values: .automatic(desiredCount: 10))
    }
    .chartYAxis {
        AxisMarks(values: .automatic(desiredCount: 10))
    }
    .chartPlotStyle { plotArea in
        plotArea
            .background(.yellow.opacity(0.02))
    }
    

    You can simply provide the function to a LinePlot to graph a function.

    swiftui-charts-lineplot.png

    The new version of SwiftUI delivers a powerful set of new APIs that give developers fine-grained control over their scroll views. The introduction of the onScrollGeometryChange modifier allows you to keep track with the state of scroll views. This new capability enables you to efficiently react to changes in the scroll view’s content offsets, content size, and other scroll-related properties.

    Here’s a sample code snippet that demonstrates how you can use this modifier to display a “Scroll to Top” button after the user has scrolled down a list:

    struct ScrollViewDemo: View {
        
        let samplePhotos = (1...20).map { Photo(name: "coffee-\($0)") }
        
        @State private var showScrollToTop = false
        
        var body: some View {
            ScrollView {
                VStack {
                    ForEach(samplePhotos) { photo in
                        Image(photo.name)
                            .resizable()
                            .scaledToFill()
                            .frame(height: 200)
                            .clipShape(RoundedRectangle(cornerRadius: 15))
                    }
                }
            }
            .padding(.horizontal)
            .overlay(alignment: .bottom) {
                if showScrollToTop {
                    Button("Scroll to top") {
                        
                    }
                    .controlSize(.extraLarge)
                    .buttonStyle(.borderedProminent)
                    .tint(.green)
                }
            }
            .onScrollGeometryChange(for: Bool.self) { geometry in
                geometry.contentOffset.y < geometry.contentInsets.bottom + 200
                
            } action: { oldValue, newValue in
                withAnimation {
                    showScrollToTop = !newValue
                }
            }
    
        }
    }
    

    The geometry of a scroll view changes frequently while scrolling. We can leverage the onScrollGeometryChange modifier to capture the update and display the “Scroll to top” button accordingly.

    SwiftUI also introduces the onScrollVisibilityChange modifier for views within a scroll view. This modifier allows you to detect when a particular view becomes visible and perform specific actions in response.

    swiftui-scrollview-visible.gif

    Suppose we have a Rectangle view at the end of a scroll view and we want to trigger a color change animation only when this view comes into view. We can use the onScrollVisibilityChange modifier to detect when the view becomes visible and when it goes off-screen.

    Rectangle()
        .fill(color)
        .frame(height: 100)
        .onScrollVisibilityChange(threshold: 0.9) { visible in
            withAnimation(.linear(duration: 5)) {
                color = visible ? .green : .blue
            }
        }
    

    You now have the ability to design custom resizable controls, like buttons and toggles, which can be placed in the Control Center or on the lock screen. Controls are a new kind of Widget that that are easy to build with App Intents.

    To create a control widget in Control Center, you adopt the ControlWidget protocol and provide the implementation. Here is a sample code provided by Apple:

    struct StartPartyControl: ControlWidget {
        var body: some ControlWidgetConfiguration {
            StaticControlConfiguration(
                kind: "com.apple.karaoke_start_party"
            ) {
                ControlWidgetButton(action: StartPartyIntent()) {
                    Label("Start the Party!", systemImage: "music.mic")
                    Text(PartyManager.shared.nextParty.name)
                }
            }
        }
    }
    

    We will further look into control widgets in a separate tutorial.

    A new Mix Modifier for Color

    You can now blend two different colors to create your desired hue by using the new mix modifier. Here is an example:

    VStack {
        Color.purple.mix(with: .green, by: 0.3)
            .frame(height: 100)
        
        Color.purple.mix(with: .green, by: 0.5)
            .frame(height: 100)
        
        Color.purple.mix(with: .green, by: 0.8)
            .frame(height: 100)
    }
    

    Simply provide the mix modifier with the color to blend and the blend ratio. SwiftUI will then generate the new color based on these parameters.

    swiftui-color-blend-mix.png

    Visual Effects for Text

    You can now extend SwiftUI Text views with custom rendering effects by adopting the TextRenderer. Here is a sample text renderer:

    struct CustomTextRenderer: TextRenderer {
        
        func draw(layout: Text.Layout, in context: inout GraphicsContext) {
            
            for line in layout {
                for (index, slice) in runs.enumerated() {
                    context.opacity = (index % 2 == 0) ? 0.4 : 1.0
                    context.translateBy(x: 0, y: index % 2 != 0 ? -15 : 15)
                    
                    context.draw(slice)
                }
            }
        }
    }
    
    struct TextAnimationDemo: View {
        var body: some View {
            Text("What's New in SwiftUI")
                .font(.system(size: 100))
                .textRenderer(CustomTextRenderer())
        }
    }
    

    By implementing the draw method, you can customize the visual effect of each character.

    swiftui-text-visual-effect.png

    Summary

    The iOS 18 update introduces a host of significant enhancements to SwiftUI. This tutorial offers a concise introduction to some of the new features. For more complex features, we will be creating detailed, standalone tutorials to thoroughly explore their applications and benefits. Be sure to stay tuned for these upcoming in-depth guides.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    A Deep Dive into SwiftData migrations – Donny Wals

    January 24, 2026

    AI, find me some work…

    January 23, 2026

    Swift adapter design pattern – The.Swift.Dev.

    January 22, 2026

    Text is not visible when the button is in disabled state

    January 21, 2026

    WWDC 2023: A Reflection on Apple’s “Spatial Computing” Journey

    January 17, 2026

    Swift facade design pattern – The.Swift.Dev.

    January 16, 2026
    Top Posts

    Understanding U-Net Architecture in Deep Learning

    November 25, 202511 Views

    Hard-braking events as indicators of road segment crash risk

    January 14, 20269 Views

    Microsoft 365 Copilot now enables you to build apps and workflows

    October 29, 20258 Views
    Don't Miss

    Designing trust & safety (T&S) in customer experience management (CXM): why T&S is becoming core to CXM operating model 

    January 24, 2026

    Customer Experience (CX) now sits at the intersection of Artificial Intelligence (AI)-enabled automation, identity and access journeys, AI-generated content…

    iPhone 18 Series Could Finally Bring Back Touch ID

    January 24, 2026

    The Visual Haystacks Benchmark! – The Berkeley Artificial Intelligence Research Blog

    January 24, 2026

    Data and Analytics Leaders Think They’re AI-Ready. They’re Probably Not. 

    January 24, 2026
    Stay In Touch
    • Facebook
    • Instagram
    About Us

    At GeekFence, we are a team of tech-enthusiasts, industry watchers and content creators who believe that technology isn’t just about gadgets—it’s about how innovation transforms our lives, work and society. We’ve come together to build a place where readers, thinkers and industry insiders can converge to explore what’s next in tech.

    Our Picks

    Designing trust & safety (T&S) in customer experience management (CXM): why T&S is becoming core to CXM operating model 

    January 24, 2026

    iPhone 18 Series Could Finally Bring Back Touch ID

    January 24, 2026

    Subscribe to Updates

    Please enable JavaScript in your browser to complete this form.
    Loading
    • About Us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • Terms and Conditions
    © 2026 Geekfence.All Rigt Reserved.

    Type above and press Enter to search. Press Esc to cancel.