Post

Replies

Boosts

Views

Activity

Reply to Setting Tint Color for Prominent Style UIBarButtonItems at App Level in iOS26
let image1 = UIImage( systemName: "person" ) let barButtonItem1 = UIBarButtonItem.init( image: image1, style: .plain, target: nil, action: nil ) barButtonItem1.tintColor = .systemPink let image2 = UIImage( systemName: "book" ) let barButtonItem2 = UIBarButtonItem.init( image: image2, style: .plain, target: nil, action: nil ) barButtonItem2.tintColor = .systemMint navigationItem.rightBarButtonItems = [ barButtonItem1, flexibleSpace, barButtonItem2 ]
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to iOS26 bottom toolbars space broken
.toolbar { ToolbarItemGroup(placement: .bottomBar) { GlassEffectContainer { Button { // } label: { VStack { Image( systemName: "car" ) Text("Car") .font(.caption2) } .padding() } .tint(.red) Button { // } label: { VStack { Image( systemName: "person" ) Text("Person") .font(.caption2) } .padding() } .tint(.blue) Button { } label: { VStack { Image( systemName: "house" ) Text("House") .font(.caption2) } .padding() } .tint(.green) Button { } label: { VStack { Image( systemName: "lightbulb" ) Text("Lightbulb") .font(.caption2) } .padding() } .tint(.indigo) Button { } label: { VStack { Image( systemName: "trash" ) Text("Trash") .font(.caption2) } .padding() } .tint(.purple) } .frame(alignment: .leadingLastTextBaseline) .frame(height: 64) .frame(maxWidth: .infinity) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’25
Reply to Widget background Image not loading IOS 17 Xcode
Here's a sample implementation of containerBackground. LMEntryView is your widget view. struct LMWidget: Widget { var supportedFamilies: [WidgetFamily] { [.systemSmall, .systemMedium] } var body: some WidgetConfiguration { StaticConfiguration(kind: "LMWidget", provider: LMTimelineProvider()) { entry in if #available(iOS 17, *) { LMEntryView(entry: entry) .frame(maxWidth: .infinity, maxHeight: .infinity) .containerBackground(Color("WidgetBackground"), for: .widget) } else { LMEntryView(entry: entry) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color("WidgetBackground")) } } .configurationDisplayName("L_M_Widget_Title".localized) .description("L_M_Widget_Description".localized) .supportedFamilies(supportedFamilies) .contentMarginsDisabled() } }
Jan ’24
Reply to SwiftUI - Navigation Bar Fails to Switch From Scroll Edge Appearance
You might want to consider implementing a Navigation Bar Appearance ViewModifier and applying it to your VStack struct MainView: View { var body: some View { ScrollView { Text("Text") } .frame(maxWidth: .infinity) } } struct TabBarView: View { var body: some View { Color.pink .frame(maxWidth: .infinity) .frame(height: 55) } } struct ContentView: View { var body: some View { NavigationView { VStack(spacing: 0) { MainView() TabBarView() // Commenting this out fixes the problem. } .background(.red) // Commenting this out _also_ fixes the problem. .opaqueNavigationBar( foregroundColor: .white, backgroundColor: .systemBrown, tintColor: .systemIndigo, shadowColor: .darkGray) .navigationBarTitleDisplayMode(.inline) .navigationTitle("Main View") } } } public struct OpaqueNavigationBarAppearance: ViewModifier { public init( font: UIFont = .preferredFont(forTextStyle: .headline), largeTitleFont: UIFont = .preferredFont(forTextStyle: .largeTitle), foregroundColor: UIColor = .clear, backgroundColor: UIColor = .secondarySystemBackground, tintColor: UIColor = .clear, shadowColor: UIColor = .clear) { let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() appearance.titleTextAttributes = [.foregroundColor: foregroundColor, .font: font] appearance.largeTitleTextAttributes = [.foregroundColor: foregroundColor, .font: largeTitleFont] appearance.shadowColor = shadowColor appearance.backgroundColor = backgroundColor UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance UINavigationBar.appearance().compactAppearance = appearance UINavigationBar.appearance().tintColor = tintColor } public func body(content: Content) -> some View { return content } } public extension View { func opaqueNavigationBar( font: UIFont = .preferredFont(forTextStyle: .headline), largeTitleFont: UIFont = .preferredFont(forTextStyle: .largeTitle), foregroundColor: UIColor = .clear, backgroundColor: UIColor = .secondarySystemBackground, tintColor: UIColor = .clear, shadowColor: UIColor = .clear) -> some View { ModifiedContent( content: self, modifier: OpaqueNavigationBarAppearance( font: font, largeTitleFont: largeTitleFont, foregroundColor: foregroundColor, backgroundColor: backgroundColor, tintColor: tintColor, shadowColor: shadowColor)) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’23
Reply to The number on the screen does not change when the variable changes.
import SwiftUI struct S1: View { @State var aa = 0 var body: some View { TabView{ S2(aa: $aa) .tabItem { Image(systemName: "person.fill") Text("1") } .toolbarBackground(.visible, for: .tabBar) .toolbarBackground(.ultraThickMaterial, for: .tabBar) S3(aa: $aa) .tabItem { Image(systemName: "person.fill") Text("2") } .toolbarBackground(.visible, for: .tabBar) .toolbarBackground(.ultraThickMaterial, for: .tabBar) } } } struct S1_Previews: PreviewProvider { static var previews: some View { S1() } } import SwiftUI struct S2: View { @State var bb = 0 @Binding var aa: Int var body: some View { VStack{ HStack{ Button { aa += 1 if aa > bb { bb += 1 } } label: { Text("+") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } Button { aa -= 1 if aa < bb { bb -= 1 } } label: { Text("-") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } } Text(String(bb)) .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility3) } .onChange(of: aa) { newValue in if aa > bb { bb += 1 } else if aa < bb { bb -= 1 } } } } struct S2_Previews: PreviewProvider { static var previews: some View { S2(aa: .constant(0)) } } import SwiftUI struct S3: View { @Binding var aa: Int var body: some View { HStack{ Button { aa += 1 } label: { Text("+") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } Button { aa -= 1 } label: { Text("-") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } } } } struct S3_Previews: PreviewProvider { static var previews: some View { S3(aa: .constant(0)) } }
Mar ’23
Reply to How to resize items in collection view to perfectly fit bigger screen sizes?
If you want to keep the itemSize same across devices you should consider calculating the interitemspacing based on the collection view content width. If you want to keep the interitemspacing same then calculate the itemSize based on the collection view content width. This is assuming you always want the same number of items on each row. Alternately consider using Compositional Layout which provides more flexibility in configuring collection view layouts. Compositional Layout
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to How to add view below navigation bar to extend scroll edge effect
Try this UIScrollEdgeElementContainerInteraction
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to Setting Tint Color for Prominent Style UIBarButtonItems at App Level in iOS26
let image1 = UIImage( systemName: "person" ) let barButtonItem1 = UIBarButtonItem.init( image: image1, style: .plain, target: nil, action: nil ) barButtonItem1.tintColor = .systemPink let image2 = UIImage( systemName: "book" ) let barButtonItem2 = UIBarButtonItem.init( image: image2, style: .plain, target: nil, action: nil ) barButtonItem2.tintColor = .systemMint navigationItem.rightBarButtonItems = [ barButtonItem1, flexibleSpace, barButtonItem2 ]
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to UIRequiresFullScreen in iPadOS 26
UIRequiresFullScreen is deprecated, as mentioned in multiple WWDC 25 sessions. Make your UIKit app more flexible, What’s new in UIKit & What’s new in SwiftUI.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to mac os 26 beta 3
It's available now.
Replies
Boosts
Views
Activity
Jul ’25
Reply to I don't want black background in presented sheet
.sheet(isPresented: $showAddSheet) { AddView() .presentationBackground(yourColor) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to hidesBottomBarWhenPushed in iOS 26
screen recording
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jun ’25
Reply to How to access clear Liquid Glass Effect?
Like this?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to iOS26 bottom toolbars space broken
.toolbar { ToolbarItemGroup(placement: .bottomBar) { GlassEffectContainer { Button { // } label: { VStack { Image( systemName: "car" ) Text("Car") .font(.caption2) } .padding() } .tint(.red) Button { // } label: { VStack { Image( systemName: "person" ) Text("Person") .font(.caption2) } .padding() } .tint(.blue) Button { } label: { VStack { Image( systemName: "house" ) Text("House") .font(.caption2) } .padding() } .tint(.green) Button { } label: { VStack { Image( systemName: "lightbulb" ) Text("Lightbulb") .font(.caption2) } .padding() } .tint(.indigo) Button { } label: { VStack { Image( systemName: "trash" ) Text("Trash") .font(.caption2) } .padding() } .tint(.purple) } .frame(alignment: .leadingLastTextBaseline) .frame(height: 64) .frame(maxWidth: .infinity) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to Widget background Image not loading IOS 17 Xcode
Here's a sample implementation of containerBackground. LMEntryView is your widget view. struct LMWidget: Widget { var supportedFamilies: [WidgetFamily] { [.systemSmall, .systemMedium] } var body: some WidgetConfiguration { StaticConfiguration(kind: "LMWidget", provider: LMTimelineProvider()) { entry in if #available(iOS 17, *) { LMEntryView(entry: entry) .frame(maxWidth: .infinity, maxHeight: .infinity) .containerBackground(Color("WidgetBackground"), for: .widget) } else { LMEntryView(entry: entry) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color("WidgetBackground")) } } .configurationDisplayName("L_M_Widget_Title".localized) .description("L_M_Widget_Description".localized) .supportedFamilies(supportedFamilies) .contentMarginsDisabled() } }
Replies
Boosts
Views
Activity
Jan ’24
Reply to iPhone 6s not showing beta updates
Doesn't look like 6s is compatible with iOS 16. Check this support article
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to IOS 16 Issues: Apple's Restrictive Customization Options May Push Users Toward Android
Bye Bye
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to SwiftUI - Navigation Bar Fails to Switch From Scroll Edge Appearance
You might want to consider implementing a Navigation Bar Appearance ViewModifier and applying it to your VStack struct MainView: View { var body: some View { ScrollView { Text("Text") } .frame(maxWidth: .infinity) } } struct TabBarView: View { var body: some View { Color.pink .frame(maxWidth: .infinity) .frame(height: 55) } } struct ContentView: View { var body: some View { NavigationView { VStack(spacing: 0) { MainView() TabBarView() // Commenting this out fixes the problem. } .background(.red) // Commenting this out _also_ fixes the problem. .opaqueNavigationBar( foregroundColor: .white, backgroundColor: .systemBrown, tintColor: .systemIndigo, shadowColor: .darkGray) .navigationBarTitleDisplayMode(.inline) .navigationTitle("Main View") } } } public struct OpaqueNavigationBarAppearance: ViewModifier { public init( font: UIFont = .preferredFont(forTextStyle: .headline), largeTitleFont: UIFont = .preferredFont(forTextStyle: .largeTitle), foregroundColor: UIColor = .clear, backgroundColor: UIColor = .secondarySystemBackground, tintColor: UIColor = .clear, shadowColor: UIColor = .clear) { let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() appearance.titleTextAttributes = [.foregroundColor: foregroundColor, .font: font] appearance.largeTitleTextAttributes = [.foregroundColor: foregroundColor, .font: largeTitleFont] appearance.shadowColor = shadowColor appearance.backgroundColor = backgroundColor UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance UINavigationBar.appearance().compactAppearance = appearance UINavigationBar.appearance().tintColor = tintColor } public func body(content: Content) -> some View { return content } } public extension View { func opaqueNavigationBar( font: UIFont = .preferredFont(forTextStyle: .headline), largeTitleFont: UIFont = .preferredFont(forTextStyle: .largeTitle), foregroundColor: UIColor = .clear, backgroundColor: UIColor = .secondarySystemBackground, tintColor: UIColor = .clear, shadowColor: UIColor = .clear) -> some View { ModifiedContent( content: self, modifier: OpaqueNavigationBarAppearance( font: font, largeTitleFont: largeTitleFont, foregroundColor: foregroundColor, backgroundColor: backgroundColor, tintColor: tintColor, shadowColor: shadowColor)) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to The number on the screen does not change when the variable changes.
import SwiftUI struct S1: View { @State var aa = 0 var body: some View { TabView{ S2(aa: $aa) .tabItem { Image(systemName: "person.fill") Text("1") } .toolbarBackground(.visible, for: .tabBar) .toolbarBackground(.ultraThickMaterial, for: .tabBar) S3(aa: $aa) .tabItem { Image(systemName: "person.fill") Text("2") } .toolbarBackground(.visible, for: .tabBar) .toolbarBackground(.ultraThickMaterial, for: .tabBar) } } } struct S1_Previews: PreviewProvider { static var previews: some View { S1() } } import SwiftUI struct S2: View { @State var bb = 0 @Binding var aa: Int var body: some View { VStack{ HStack{ Button { aa += 1 if aa > bb { bb += 1 } } label: { Text("+") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } Button { aa -= 1 if aa < bb { bb -= 1 } } label: { Text("-") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } } Text(String(bb)) .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility3) } .onChange(of: aa) { newValue in if aa > bb { bb += 1 } else if aa < bb { bb -= 1 } } } } struct S2_Previews: PreviewProvider { static var previews: some View { S2(aa: .constant(0)) } } import SwiftUI struct S3: View { @Binding var aa: Int var body: some View { HStack{ Button { aa += 1 } label: { Text("+") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } Button { aa -= 1 } label: { Text("-") .frame(width: 140, height: 50) .background { RoundedRectangle(cornerRadius: 15, style: .continuous) .fill(Color(red: 0.888, green: 0.536, blue: 0.785)) .frame(width: 140, height: 50) } .foregroundColor(Color(red: 1.002, green: 0.967, blue: 0.69)) .multilineTextAlignment(.center) .bold() .dynamicTypeSize(.accessibility1) } } } } struct S3_Previews: PreviewProvider { static var previews: some View { S3(aa: .constant(0)) } }
Replies
Boosts
Views
Activity
Mar ’23
Reply to The number on the screen does not change when the variable changes.
You should make aa a State var aa = 0 in S1 and make it a @Binding var aa: Int in both S2 & S3.
Replies
Boosts
Views
Activity
Mar ’23
Reply to How to resize items in collection view to perfectly fit bigger screen sizes?
If you want to keep the itemSize same across devices you should consider calculating the interitemspacing based on the collection view content width. If you want to keep the interitemspacing same then calculate the itemSize based on the collection view content width. This is assuming you always want the same number of items on each row. Alternately consider using Compositional Layout which provides more flexibility in configuring collection view layouts. Compositional Layout
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22