Yesterday on Explore the biggest updates from WWDC Curt Clifton shared .background(.tint, in: .rect(corner: .containerConcentric)). XCode26 beta 3 don‘t recognize it. how when we can use it??
Create elegant and intuitive apps that integrate seamlessly with Apple platforms.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Someone smarter than me please tell me if this will work... I want to have an edit screen for a SwiftData class. Auto Save is on, but I want to be able to revert changes. I have read all about sending a copy in, sending an ID and creating a new context without autosave, etc.
What about simply creating a second set of ephemeral values in the actual original model. initialize them with the actual fields. Edit them and if you save changes, migrate that back to the permanent fields before returning.
Don't have to manage a list of @State variables corresponding to every model field, and don't have to worry about a second model context.
Anyone have any idea of the memory / performance implications of doing it this way, and if it is even possible? Does this just make a not quite simple situation even more complicated? Haven't tried yet, just got inspiration from reading some medium content on attributes on my lunch break, and wondering if I am just silly for considering it.
I am trying to create a menu picker for two or three text items. Small miracles, but I have it basically working. Problem is it uses a set, and I want to pass arrays. I need to modify PickerView so the Bound Parameter is an [String] instead of Set. Have been fighting this for a while now... Hoping for insights.
struct PickerView: View {
@Binding var colorChoices: Set<String>
let defaults = UserDefaults.standard
var body: some View {
let possibleColors = defaults.object(forKey: "ColorChoices") as? [String] ?? [String]()
Menu {
ForEach(possibleColors, id: \.self) { item in
Button(action: {
if colorChoices.contains(item) {
colorChoices.remove(item)
} else {
colorChoices.insert(item)
}
}) {
HStack {
Text(item)
Spacer()
if colorChoices.contains(item) {
Image(systemName: "checkmark")
}
}
}
}
} label: {
Label("Select Items", systemImage: "ellipsis.circle")
}
Text("Selected Colors: \(colorChoices, format: .list(type: .and))")
}
}
#Preview("empty") {
@Previewable @State var colorChoices: Set<String> = []
PickerView(colorChoices: $colorChoices)
}
#Preview("Prefilled") {
@Previewable @State var colorChoices: Set<String> = ["Red","Blue"]
PickerView(colorChoices: $colorChoices)
}
My Content View is suppose to set default values the first time it runs, if no values already exist...
import SwiftUI
struct ContentView: View {
@State private var viewDidLoad: Bool = false
var body: some View {
HomeView()
.onAppear { // The following code should execute once the first time contentview loads. If a user navigates back to it, it should not execute a second time.
if viewDidLoad == false {
viewDidLoad = true
// load user defaults
let defaults = UserDefaults.standard
// set the default list of school colors, unless the user has already updated it prior
let defaultColorChoices: [String] = ["Black","Gold","Blue","Red","Green","White"]
let colorChoices = defaults.object(forKey: "ColorChoices") as? [String] ?? defaultColorChoices
defaults.set(colorChoices, forKey: "ColorChoices")
}
}
}
}
#Preview {
ContentView()
}
PickLoader allows you to dynamically add or delete choices from the list...
import SwiftUI
struct PickLoader: View {
@State private var newColor: String = ""
var body: some View {
Form {
Section("Active Color Choices") {
// we should have set a default color list in contentview, so empty string should not be possible.
let defaults = UserDefaults.standard
let colorChoices = defaults.object(forKey: "ColorChoices") as? [String] ?? [String]()
List {
ForEach(colorChoices, id: \.self) { color in
Text(color)
}
.onDelete(perform: delete)
HStack {
TextField("Add a color", text: $newColor)
Button("Add"){
defaults.set(colorChoices + [newColor], forKey: "ColorChoices")
newColor = ""
}
}
}
}
}
.navigationTitle("Load Picker")
Button("Reset Default Choices") {
let defaults = UserDefaults.standard
//UserDefaults.standard.removeObject(forKey: "ColorChoices")
let colorChoices: [String] = ["Black","Gold","Blue","Red","Green","White"]
defaults.set(colorChoices, forKey: "ColorChoices")
}
Button("Clear all choices") {
let defaults = UserDefaults.standard
defaults.removeObject(forKey: "ColorChoices")
}
}
}
func delete(at offsets: IndexSet) {
let defaults = UserDefaults.standard
var colorChoices = defaults.object(forKey: "ColorChoices") as? [String] ?? [String]()
colorChoices.remove(atOffsets: offsets)
defaults.set(colorChoices, forKey: "ColorChoices")
}
#Preview {
PickLoader()
}
And finally HomeView is where I am testing from - to see if binding works properly...
import SwiftUI
struct HomeView: View {
//@State private var selection: Set<String> = []
//@State private var selection: Set<String> = ["Blue"]
@State private var selection: Set<String> = ["Blue", "Red"]
var body: some View {
NavigationStack {
List {
Section("Edit Picker") {
NavigationLink("Load Picker") {
PickLoader()
}
}
Section("Test Picker") {
PickerView(colorChoices: $selection)
}
Section("Current Results") {
Text("Current Selection: \(selection, format: .list(type: .and))")
}
}
.navigationBarTitle("Hello, World!")
}
}
}
#Preview {
HomeView()
}
If anyone uses this code, there are still issues - buttons on Loader don't update the list on the screen for one, and also dealing with deleting choices that are in use - how does picker deal with them? Probably simply add to the list automatically and move on. If anyone has insights on any of this also, great! but first I just need to understand how to accept an array instead of a set in pickerView.
I have tried using a computed value with a get and set, but I can't seem to get it right.
Thanks for any assistance! Cheers!
I've been experimenting with Liquid Glass quite a bit and watched all the WWDC videos. I'm trying to create a glassy segmented picker, like the one used in Camera:
however, it seems that no matter what I do there's no way to recreate a truly clear (passthrough) bubble that just warps the light underneath around the edges. Both Glass.regular and Glass.clear seem to add a blur that can not be evaded, which is counter to what clear ought to mean.
Here are my results:
I've used SwiftUI for my experiment but I went through the UIKit APIs and there doesn't seem to be anything that suggests full transparency.
Here is my test SwiftUI code:
struct GlassPicker: View {
@State private var selected: Int?
var body: some View {
ScrollView([.horizontal], showsIndicators: false) {
HStack(spacing: 0) {
ForEach(0..<20) { i in
Text("Row \(i)")
.id(i)
.padding()
}
}
.scrollTargetLayout()
}
.contentMargins(.horizontal, 161)
.scrollTargetBehavior(.viewAligned)
.scrollPosition(id: $selected, anchor: .center)
.background(.foreground.opacity(0.2))
.clipShape(.capsule)
.overlay {
DefaultGlassEffectShape()
.fill(.clear) // Removes a semi-transparent foreground fill
.frame(width: 110, height: 50)
.glassEffect(.clear)
}
}
}
Is there any way to achieve the above result or does Apple not trust us devs with more granular control over these liquid glass elements?
Hi all.
I have tried using UIDesignRequiresCompatibility YES & NO for an application.
Running on iOS 26 BETA 5 makes no difference to the UI.
Running on Simulator MacOSS 26 BETA 5 makes no difference to the UI.
Anyone had luck with this info plist setting?
I’m not seeing Liquid Glass on any standard components. A month ago around July 17th I ran our app and saw Liquid Glass on our tab view and various standard components. Those components have not been changed and yet I’m no longer seeing Liquid Glass in our app at all.
Components that were previously liquid glass but now are not include TabView and back navigation buttons.
I set the UIDesignRequiresCompatibility key explicitly to false but no luck. I was seeing this in Beta 7 and Beta 8 on a real device and on a sim.
Dear Apple Developer Relations Team,
We are currently reviewing the documentation for the UIDesignRequiresCompatibility Info.plist key.
In the documentation, there is a warning that states:
"Temporarily use this key while reviewing and refining your app’s UI for the design in the latest SDKs."
However, in the adoption guide for Liquid Glass:
Adopting Liquid Glass, we did not see any explicit requirement to force adoption of the Liquid Glass design.
We have the Gojek app, which currently uses the UIDesignRequiresCompatibility key. To ensure long-term stability, we would like clarification on the following points:
Future Support of the Key:
Is it safe to continue using the UIDesignRequiresCompatibility key? Can you confirm whether this key will remain supported or if there are plans for it to be deprecated/removed in future iOS versions?
Liquid Glass Adoption:
Our app’s design guidelines do not align with the Liquid Glass style. Can you confirm that adoption of Liquid Glass is not mandatory, and that apps can continue to use their existing custom design guidelines without any restrictions?
Compatibility with iOS 26:
Are there any required changes we need to make to our existing views to ensure that the UI will continue to render as it does today on iOS 26 and beyond?
We want to make sure we provide the best user experience while remaining compliant with Apple’s guidelines. Your clarification would help us plan our design and development roadmap accordingly.
Thank you for your support and guidance.
Looking at the UIDesignRequiresCompatibility documentation, watchOS is not listed among the supported platforms. When added to the project, it is also being ignored, resulting in Liquid Glass design. It is possible to opt-out from Liquid Glass design temporarily. Is that just an oversight for Apple Watch please?
I would like to propose a design enhancement for future iPhone models: using the existing bottom-right antenna line (next to the power button area) as a capacitive “volume control zone” that supports swipe gestures.
Today this line is a structural antenna break, but it is also located exactly where the thumb naturally rests when holding the phone in one hand. With a small embedded capacitive/force sensor, the user could slide their finger along this zone to control volume without reaching for the physical buttons.
Why this makes sense:
• Perfect ergonomic thumb position in both portrait and landscape
• One-handed volume adjustment becomes easier for large-screen devices
• Silent and frictionless vs. clicking buttons (useful in meetings / night mode)
• Consistent with Apple’s recent move toward contextual hardware input (Action Button, Capture Button, Vision Pro gestures)
The interaction model would be:
• Swipe up → increase volume
• Swipe down → decrease volume
• (Optional) long-press haptic = mute toggle
This could also enhance accessibility, especially for users with reduced hand mobility who struggle to press mechanical buttons on tall devices.
Technically, this would be similar to the Capture Button (capacitive + pressure layers), but linear instead of pressure-based. It does not replace physical buttons, it complements them as a silent gesture-based alternative.
Thank you for considering this as a future interaction refinement for iPhone hardware design.
I like this font. but in license only allowed for use in Mockup UI.
Feel free to use in commercial?
https://mobbin.com/apps/bloom-ios-e1251835-34e6-426e-9f94-f9595f2567fa/1c919e9a-d144-4aa0-b788-f9752111e281/screens
I need this app solution
There is a display issue when browsing wireless networks in the dropdown menu.
In iOS version 18.1.1, the Wi-Fi switch is in the closed state;
Step 1: Open the notification dropdown, and the first image bug appears;
It will take some time for it to display [normally.]
I'm trying to achieve a specific UI design in SwiftUI where the bottom section of my List has a different background color than the top section. For example in the Medications portion of the Health app, the "Your Medications" Section has a different background than the top "Log" Section. How do I achieve this?:
Here some example code. I wonder if I am supposed to use two Lists instead. If I use two Lists though and nest it in a ScrollView, the height of the lists needs to be specified. I am working with dynamic content, though so I don't think that is ideal.
class ProtocolMedication {} // Example model
struct HomeView: View {
@Query private var protocolMedications: [ProtocolMedication]
var body: some View {
NavigationStack {
List {
// Upper sections with default background
Section {
Text("Content 1")
} header: {
Text("Log")
}
// Bottom section that needs different background
Section {
ForEach(protocolMedications) { medication in
Text(medication.name)
}
} header: {
Text("Your Medications")
}
}
.listStyle(.insetGrouped)
}
}
}
Recently I decided to download my app from the App Store and found out that during the first launch some colors were missing or displayed incorreclty. For example one button was blue, although switching dark mode on and off solved button color it. Some colors were completely missing and the tab bar buttons were blue as well. Any advices?
I'm using iOS 18.2 and XCode 16.1
Is it possible to change the default save dialog that appears when creating a document based MacOS app in SwiftUI?
I have a basic FileDocument struct that gets called to a view using a DocumentGroup scene.
struct MyFile: FileDocument {
static let readableContentTypes: [UTType] = [.myFileType]
static let writeableContentTypes: [UTType] = [.myFileType]
var list: [String]
init(configuration: ReadConfiguration) throws {
let data = configuration.file.regularFileContents!
let JSONDecoder = JSONDecoder()
do {
try list = JSONDecoder.decode([String].self, from: data)
} catch {
throw CocoaError(.fileReadCorruptFile)
}
}
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
let JSONEncoder = JSONEncoder()
JSONEncoder.outputFormatting = .prettyPrinted
do {
data = try JSONEncoder.encode(self.list)
} catch {
print(error.localizedDescription)
throw CocoaError(.fileWriteUnknown)
}
return .init(regularFileWithContents: data)
}
}
This gets called at the DocumentGroup
DocumentGroup(newDocument: MyFile(), editor: { document in
ContentView(document: document.$document)
})
But when I save the file, I want the save dialog that appears to have something like a 'Tags' textField that can also store information about the file.
Something similar to this: (https://i.sstatic.net/AJQ3YNb8.png)
From what I can find, there isn't much information about this other than manually creating an NSSavePanel class and overriding the current save function
I'm trying to create custom SF symbols and am getting this error message when I validate the template. It doesn't matter if I Export Template or Symbol. Also, it doesn't even matter if I make any changes or not, as long as it is opened in Adobe Illustrator or Inkscape and then I save it, I will get this error message when validating.
Hello everyone,
I'm stuck here, i have developed an app, and i keep getting from Apple "Guideline 4.3(a) - Design - Spam" - We continue to notice that your app shares a similar binary, metadata, and/or concept as apps submitted to the App Store by other developers, with only minor differences.
As i was looking around this seems to be so much an issue now for many people and i don't understand why.
My app which is approved in Android already it have an unique design built my own, and the most important the content (in this case futures crypto signals) are created by my own strategy, so it can be no where else found.
I literally have no idea what to do next, i don't want to do major changes because i don't believe the app looks similar to any other app and for the reason that its already in Google Play Store i don't want to do major UI design.
We would greatly appreciate any valuable advice from fellow developers in the community to help us navigate this challenge and successfully pass the review
I want to make my buttons inline with each other, but spaced apart, a bit like the apple topbar BUT in swift.
My code:
struct NormalPageView: View {
var body: some View {
VStack {
NavigationView {
Form {
Section {
Image(systemName: "house.fill")
Spacer()
Image(systemName: "plus")
Spacer()
Image(systemName: "gearshape.fill")
}
}
}
I'm running into a problem with the focus order in my UICollectionView in my tvOS app. The layout of my app is outlined in the following diagram
On the uppermost layer I have a UITableView, each cell containing a single UICollectionView that can contain a variable number of UICollectionViewCells.
When the user swipes down, I want the left-most item in the next row down to be selected, as follows:
I've been able to get this to work for the majority of cases. The exception is when the previously focused item extends to the length of the screen - in this case the next focused item isn't the leftmost item, but rather the center item, as follows.
Using focus guides won't really fit the use case here since collection views are dynamically generated.
I've found that there is a function in UICollectionViewDelegate, indexPathForPreferredFocusedView that should help here but it only seems to be called intermittedly, even though I have set remembersLastFocusedIndexPath on the collectionview to true. I can force it to be called by calling setNeedsFocusUpdate() but I can't figure out a good place to call it - shouldUpdateFocus is too early and didUpdateFocus is too late.
Is there some way to constrain the focus area of a view to a certain subset of it's frame - for example, the left-most quarter of its width?
Or does anyone know of some other solution to this problem?
Hi everyone, im in the process of delving more into coregraphics with swiftui, but I am at a roadblock.
First I would like to ask, what are some good resources to learn coregraphics?
Secondly:
I currently have a circle view made and what I want to do is to make my circle view modular so that it can be directly connected to another given circle by a line. How can I do this?
For example, I want my circles to represent nodes and be able to connect by lines to other nodes that are related.
Thanks in advanced.
Here is my code for the circle view:
@State private var circleProgress: CGFloat = 0
let timer = Timer.publish(every: 0.016, on: .main, in: .common).autoconnect()
private let animationDuration: TimeInterval = 1.5
@Binding var startPoint: CGPoint
@Binding var endPoint: CGPoint
var body: some View {
GeometryReader { geometry in
Canvas { context, size in
// Circle parameters
let circleSize: CGFloat = 50
let circleOrigin = CGPoint(
x: size.width / 4,
y: size.height / 2 - circleSize / 2
)
let circleRect = CGRect(
origin: circleOrigin,
size: CGSize(width: circleSize, height: circleSize)
)
let circleCenter = CGPoint(
x: circleOrigin.x + circleSize / 2,
y: circleOrigin.y + circleSize / 2
)
// Animate circle creation
var circlePath = Path()
circlePath.addArc(
center: circleCenter,
radius: circleSize / 2,
startAngle: .degrees(0),
endAngle: .degrees(360 * circleProgress),
clockwise: false
)
context.addFilter(.shadow(color: .white.opacity(0.6), radius: 5, x: 1, y: 1)) // Add white shadow
context.stroke(
circlePath,
with: .linearGradient(
Gradient(colors: [.purple, .white]),
startPoint: circleRect.origin,
endPoint: CGPoint(x: circleRect.maxX, y: circleRect.maxY)
),
lineWidth: 5
)
}
.frame(width: 300, height: 150)
.onReceive(timer) { _ in
// Update circle progress
let progressChange = 0.02 / animationDuration
if circleProgress < 1.0 {
circleProgress = min(circleProgress + progressChange, 1.0)
} else {
circleProgress = 0.0 // Reset the circle to repeat the animation
}
// Get the starting and ending points of the Canvas view
startPoint = CGPoint(x: geometry.frame(in: .global).minX, y: geometry.frame(in: .global).minY)
endPoint = CGPoint(x: geometry.frame(in: .global).maxX, y: geometry.frame(in: .global).maxY)
// Print the points for debugging
print("Start Point: \(startPoint.x), \(startPoint.y)")
print("End Point: \(endPoint.x), \(endPoint.y)")
}
}
.frame(width: 300, height: 150)
}
}