Hi Community!
I'm wrangling with this for a few days now and can't find a way to fix it, but I see it working in other apps.
I have a regular UIToolbar with buttons, assigning it as inputAccessoryView to a UITextView, so the toolbar appears above the keyboard (I can reproduce this also in SwiftUI).
The toolbar contains regular UIBarButtonItems, except one doesn't have an action, it has a UIMenu (using .menu = UIMenu...).
In the Apple Notes app, there is also one button that shows a menu like that. When you tap on the button, the toolbar disappears and the menu shows directly above the keyboard.
However, in my code it shows above the hidden toolbar, means there is a huge gap between keyboard and menu. It works if I attach the toolbar (in SwiftUI) to the navigation at the top or bottom, just with the keyboard it behaves differently.
Here is some sample code for the toolbar:
private lazy var accessoryToolbar: UIToolbar = {
let toolbar = UIToolbar()
let bold = UIBarButtonItem(image: UIImage(systemName: "bold"), style: .plain, target: self, action: #selector(didTapToolbarButton(_:)))
let italic = UIBarButtonItem(image: UIImage(systemName: "italic"), style: .plain, target: self, action: #selector(didTapToolbarButton(_:)))
let underline = UIBarButtonItem(image: UIImage(systemName: "underline"), style: .plain, target: self, action: #selector(didTapToolbarButton(_:)))
let todo = UIBarButtonItem(image: UIImage(systemName: "checklist"), style: .plain, target: self, action: #selector(didTapToolbarButton(_:)))
// Make the Bullet button open a menu of list options
let bullet = UIBarButtonItem(image: UIImage(systemName: "list.bullet"), style: .plain, target: self, action: nil)
let bulletMenu = UIMenu(title: "Insert List", children: [
UIAction(title: "Bulleted List", image: UIImage(systemName: "list.bullet")) { [weak self] _ in
self?.handleMenuSelection("Bulleted List")
},
UIAction(title: "Numbered List", image: UIImage(systemName: "list.number")) { [weak self] _ in
self?.handleMenuSelection("Numbered List")
},
])
bullet.menu = bulletMenu
toolbar.items = [bold, italic, underline, todo, bullet]
toolbar.sizeToFit()
return toolbar
}()
Somewhere else in the code assign it to the UITextView:
// Attach the toolbar above the keyboard
textView.inputAccessoryView = accessoryToolbar
Toolbar:
Menu open:
In Apple Notes:
I feel I miss something. In Apple notes I can also see a Liquid Glass style gradient between the toolbar and keyboard, dimming the content in this space.
Swift
RSS for tagSwift is a powerful and intuitive programming language for Apple platforms and beyond.
Posts under Swift tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I've tried to find a solution for this problem for weeks now but it seems no one knows how to solve it and Apple doesn't seem to care.
I have a NavigationSplitView with two columns. In the detail column I have a button - or any other clickable control - which is placed in the very top where usually the safe area resides.
The button is NOT clickable when he is in the safe area and I have NO idea why. I know I can place buttons in safe areas of other views and they are clickable.
Please have a look at the code:
`struct NavTestView: View {
var body: some View {
GeometryReader { p in
VStack(spacing: 0) {
NavigationSplitView {
List(names) {
Text($0.name).frame(width: p.size.width)
.background(Color.green)
}.listRowSpacing(p.size.height * 0.15 / 100 )
.toolbar(.hidden, for: .navigationBar)
} detail: {
TestView().ignoresSafeArea()
}.frame(width: p.size.width, height: p.size.height, alignment: .topLeading)
.background(Color.yellow)
}
}
}
}
struct TestView: View {
var body: some View {
GeometryReader { p in
let plusButton = IconButton(imageName: "plus.circle.fill", color: Color(uiColor: ThemeColor.SeaFoam.color),
imageWidth: p.size.width * 5 / 100, buttonWidth: p.size.width * 5 / 100)
let regularAddButton = Button(action: { log.info("| Regular Add Button pressed") } ) {
plusButton
}
VStack {
regularAddButton
}.frame(width: p.size.width , height: p.size.height, alignment: .top)
.background(Color.yellow)
}
}
}
`
this code produces the following screen:
Any help would be really greatly appreciated!
Thank you!
Frank
Hi,
I have a NavigationSplitView with a view in the detail section:
NavigationSplitView {
ZStack {
Color.black.ignoresSafeArea()
gradientBlack2Blue.opacity(0.25)
.ignoresSafeArea()
GeometryReader { p in
VStack {
List {
SidebarViewCell(id: "1",
text: "Steuersätze" ,
type: .TAX_MASTERDATA ,
selectedMasterdataType: $selectedMasterdataType)
}.listRowSpacing(size.height * 1.25 / 100 )
.scrollContentBackground(.hidden)
.toolbar(.hidden, for: .navigationBar)
.frame(width: p.size.width * 98 / 100 , height: p.size.height,
alignment: .topLeading).
}alignment: .topLeading)
}
}
}
detail: {
MasterdataDetailView().ignoresSafeArea()
}
}.navigationSplitViewStyle(.balanced)
When I place a Button-Control in the MasterdataDetailView it cannot be clicked because it is in the safe area. How can I make it clickable?
Best Regards,
Frank
Hi all, I'm tuning my app prediction speed with Core ML model. I watched and tried the methods in video: Improve Core ML integration with async prediction and Optimize your Core ML usage. I also use instruments to look what's the bottleneck that my prediction speed cannot be faster.
Below is the instruments result with my app. its prediction duration is 10.29ms
And below is performance report shows the average speed of prediction is 5.55ms, that is about half time of my app prediction!
Below is part of my instruments records. I think the prediction should be considered quite frequent. Could it be faster?
How to be the same prediction speed as performance report? The prediction speed on macbook Pro M2 is nearly the same as macbook Air M1!
"/Users/rich/Work/IdeaBlitz/IdeaBlitz/IdeaListView.swift:30:25 The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions"
Is it just me? I get this on syntax errors, missing commas, missing quotes, and for no particular reason at all that I can see. I don't think I've been able to write a single, simple, SwiftUI view without seeing this multiple times.
"Breaking it up" just makes it harder to read. Simple, inline, 2-page views become 8-page, totally unreadable, monstrosities.
Am I doing something wrong? Or is this just the state of SwiftUI today? Or is there some way to tell the compiler to take more time on this expression? I mean, if these can be broken up automatically, then why doesn't the compiler to that already?
I’m integrating the Declared Age Range feature to tailor our app’s experience based on a user’s age range. I’m currently in the testing phase and would like to repeatedly test the consent flow and different outcomes from AgeRangeService.shared.requestAgeRange(...).
However, once I go through the consent flow and choose to share, the age-range sharing sheet no longer appears on subsequent attempts—so it’s hard to validate edge cases (e.g., changed gates, declined flow, re-prompt behavior).
Could you advise on the recommended way to reset or re-prompt during development? In particular:
Is there a supported way to clear per-app consent so the system prompts again?
Under what conditions should the “Share Age Range Again” control appear in Settings, and is there an equivalent way to trigger it for testing?
Are there best practices for QA (e.g., using Ask First at the system level, testing on real devices vs. Simulator, using a separate bundle ID for dev builds, or other steps)?
Any other guidance for validating different requestAgeRange results (e.g., declined/not available) would be appreciated.
In SwiftUI I am using the manageSubscriptionsSheet modifier to open the iOS subscription screen. When this is presented it immediately flashes a white view and then animated the subscription screen up from the bottom, it looks pretty bad.
The view I am calling manageSubscriptionsSheet on is presented in a sheet, so maybe trying to present the subscriptions view as well is causing the visual glitch. Any way to not have this white flashing view when opening the subscription screen?
Hi,
is there a compiled version of MailCore.swift? I want to build an easy-to-use mail app for my mother, who is 97, has a MacBook Air, but Apple Mail is too complicated for her. chatGPT said I am too stupid to compile it by myself.
Regards Stephan
Hello!
Bare with me here, as there is a lot to explain!
I am working on implementing a Game Center high score leaderboard into my game. I have looked around for examples of how to properly implement this code, but have come up short on finding much material. Therefore, I have tried implementing it myself based off information I found on apples documentation.
Long story short, I am getting success printed when I update my score, but no scores are actually being posted (or at-least no scores are showing up on the Game Center leaderboard when opened).
Before I show the code, one thing I have questioned is the fact that this game is still in development. In AppStoreConnect, the status of the leaderboard is "Not Live". Does this affect scores being posted?
Onto the code. I have created a GameCenter class which handles getting the leaderboards and posting scores to a specific leaderboard. I will post the code in whole, and will discuss below what is happening.
PLEASE VIEW ATTACHED TEXT TO SEE THE GAMECENTER CLASS!
GameCenter class - https://developer.apple.com/forums/content/attachment/0dd6dca8-8131-44c8-b928-77b3578bd970
In a different GameScene, once the game is over, I request to post a new high score to Game Center with this line of code:
GameCenter.shared.submitScore(id: GameCenterLeaderboards.HighScore.rawValue)
Now onto the logic of my code. For the longest time I struggled to figure out how to submit a score. I figured out that in Xcode 12, they deprecated a lot of functions that previously worked for me. Not is seems that we have to load all leaderboards (or the ones we want). That is the purpose behind the leaderboards private variable in the Game Center class.
On the start up of the app, I call authenticate player. Once this callback is reached, I call loadLeaderboards which will load the leaderboards for each string id in an enum that I have elsewhere. Each of these leaderboards will be created as a Leaderboard object, and saved in the private leaderboard array. This is so I have access to these leaderboards later when I want to submit a score.
Once the game is over, I am calling submitScore with the leaderboard id I want to post to. Right now, I only have a high score, but in the future I may add a parameter to this with the value so it works for other leaderboards as well. Therefore, no value is passed in since I am pulling from local storage which holds the high score.
submitScore will get the leaderboard from the private leaderboard array that has the same id as the one passed in. Once I get the correct leaderboard, I submit a score to that leaderboard. Once the callback is hit, I receive the output "Successfully submitted score to leaderboard". This looks promising, except for the fact that no score is actually posted.
At startup, I am calling updatePlayerHighScore, which is not complete - but for the purpose of my point, retrieves the high score of the player from the leaderboard and is printing it out to the console. It is printing out (0), meaning that no score was posted.
The last thing I have questions about is the context when submitting a score. According to the documentation, this seems to just be metadata that GameCenter does not care about, but rather something the developer can use. Therefore, I think I can cross this off as causing the problem.
I believe I implemented this correctly, but for some reason, nothing is posting to the leaderboard. This was ALOT, but I wanted to make sure I got all my thoughts down.
Any help on why this is NOT posting would be awesome! Thanks so much!
Mark
SceneDelegate's sceneWillEnterForeground and sceneDidEnterBackground methods are not called when app is moved to the background and back. It happens when Stage Manager is enabled and application is moved to the background using App Switcher (double tap on the home button).
Otherwise methods are called.
Started to reproduce since iOS26. Is not reproducible on iOS18.
I'm trying to understand how UIDevice.current.identifierForVendor behaves when an iOS app is restored via iCloud onto a different physical device.
Context
I'm building an app that needs to detect whether it’s running on a newly restored device (for example, after the user transfers their iPhone via iCloud setup).
To do this, I save the value of UIDevice.current.identifierForVendor?.uuidString in persistent storage (e.g., UserDefaults).
The question
If I install my app on Device A, store the identifierForVendor value, back up the device to iCloud,
and then restore that backup onto Device B, will the restored app see the same identifierForVendor value, or a new one?
More specifically:
Does iCloud backup/restore preserve the underlying “vendor” ID across devices?
Is the identifierForVendor tied only to the bundle identifier and vendor prefix, or also to the physical device hardware?
If the user deletes all apps from the same vendor, then restores them from iCloud, is the ID reset?
What I’ve found so far
Apple’s docs say:
“The value of this property is the same for apps that come from the same vendor running on the same device.
If the user deletes all of that vendor’s apps from the device and then reinstalls one or more of them, the value may change.”
However, it doesn’t explicitly mention what happens after iCloud restore onto a new device.
Goal
I want to know if it’s safe to use identifierForVendor to detect a new device context (e.g., trigger a refresh of a Firebase token when the user’s device changes).
Environment
iOS 17+ (latest)
Swift / Capacitor app bridge
Testing between iPhone 14 Pro → iPhone 15 Pro (iCloud restore)
Why is there always such a long hang when first switching tabs or popping up the keyboard in SwiftUI Development?
Ever since Xcode Version 26.0.1 I cannot for the life of me make my buttons rectangular. They are all capsule (or oval) shaped. My interface was designed for square buttons but no matter what I do the issue stays the same. This is what I have (it's fairly barebones but would have worked before I believe):
@IBOutlet weak var PagesInterface: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
PagesInterface.layer.cornerRadius = 0
PagesInterface.layer.masksToBounds = true
}
Hi Apple Team and community,
We've noticed a change in how UITableView separators are rendered in iOS 26 (tested using Xcode 26.0), and we'd like to confirm if this is an intentional behaviour change or a potential bug.
Issue Description
In a .plain-style UITableView, the top separator line above the first cell in each section is no longer rendered in iOS 26. We've confirmed that this separator is also absent from the view hierarchy.
This issue did not occur in previous iOS versions (e.g., iOS 18), where the top separator above the first cell of a section was rendered as expected.
The issue doesn't occur for UITableView with no sections.
Expected Behavior
When using a .plain style UITableView, the standard top separator should appear above the first cell of each section, as part of the default system rendering.
Actual Behavior
In iOS 26, this top separator is missing, even though the rest of the separators render normally.
Environment
iOS version: iOS 26 (Simulator)
Xcode version: Xcode 26.0
Tested using: UIKit with Swift, both Storyboard and programmatic view setups
Sample app and screenshots:
Drive link: https://drive.google.com/drive/folders/1aoXeFHO_Sya-6Rvp0fZ0s2V4KLQucRMb?usp=sharing
Questions:
Is this a known change in rendering behavior for UITableView in iOS 26?
If not, is anyone else experiencing the same issue? We'd appreciate any insights or potential workarounds to restore the top separator in .plain-style table views.
Any clarification or guidance would be appreciated.
Thanks in advance!
Hi everyone,
We’re currently using CKSyncEngine to sync all our locally persisted data across user devices (iOS and macOS) via iCloud.
We’ve noticed something strange and reproducible:
On iOS, when the CKSyncEngine is initialized with manual sync behavior, both manual calls to fetchChanges() and sendChanges() happen nearly instantly (usually within seconds). Automatic syncing is also very fast.
On macOS, when the CKSyncEngine is initialized with manual sync behavior, fetchChanges() and sendChanges() are also fast and responsive.
However, once CKSyncEngine is initialized with automatic syncing enabled on macOS:
sendChanges() still appears to transmit changes immediately.
But automatic fetching becomes significantly slower — often taking minutes to pick up changes from the cloud, even when new data is already available.
Even manual calls to fetchChanges() behave as if they’re throttled or delayed, rather than performing an immediate fetch.
Our questions:
Is this delay in automatic (and post-automatic manual) fetch behavior on macOS expected, or possibly a bug?
Are there specific macOS constraints that impact CKSyncEngine differently than on iOS?
Once CKSyncEngine has been initialized in automatic mode, is fetchChanges() no longer treated as a truly manual trigger?
Is there a recommended workaround to enable fast sync behavior on macOS — for example, by sticking to manual sync configuration and triggering sync using a CKSubscription-based mechanism when remote changes occur?
Any guidance, clarification, or experiences from other developers (or Apple engineers) would be greatly appreciated — especially regarding maintaining parity between iOS and macOS sync performance.
Thanks in advance!
Hi everyone,
I’m currently working on a project based on the Telegram iOS open-source code. My goal is to build an unofficial Telegram client with Telegram’s permission (they have publicly allowed third-party clients under their open-source license).
My app includes unique new features and UI improvements that are not present in the official Telegram app. Essentially, it’s Telegram plus additional features — built from the official source, but extended significantly.
However, when I try to submit my app to the App Store, Apple rejects the build under Guideline 4.3(a) - Design - Spam with this message:
“We still noticed your app shares a similar binary, metadata, and/or concept as apps submitted to the App Store by other developers, with only minor differences. Submitting similar or repackaged apps is a form of spam that creates clutter and makes it difficult for users to discover new apps.”
I completely understand Apple’s intent to prevent low-effort clones or spam apps. However, in my case, this is a legitimate open-source-based project with new and unique functionality. I’ve spent a lot of time designing new features and improving user experience — this is not just a rebrand.
Has anyone else experienced this issue when submitting an app based on an open-source client (like Telegram)?
Is there any recommended approach to help Apple differentiate my app as a distinct and valuable product?
Any advice or guidance would be greatly appreciated! 🙏
—
Additional Context:
The app is based on Telegram’s open-source iOS client.
The app includes new features and UI changes.
It’s submitted under a different name, icon, and bundle ID.
I’m happy to comply with any additional clarification Apple might need.
Thanks in advance to anyone who can share insight or experiences with this kind of rejection.
Topic:
App Store Distribution & Marketing
SubTopic:
App Review
Tags:
iOS
Swift
App Review
App Store Connect
I am trying to resize a Window Form after it loads and have done quite a bit of searching for code to do it.
Here is one code snippet that works to size the form during the design phase.
self.view.window?.contentMinSize = CGSize(width: 1100, height: 310)
I have tried code like below to increase the window size after the Form loads
if let myWindow = self.view.window ?? NSApplication.shared.mainWindow
{
// Increase window size and position after it loads
let newRect = NSRect(x: 100, y: 100, width: 1400, height: 900)
}
It seems that this code not only changes the Form size after loading, but also changes the size of the Form in Main.swift, which is something I don't want.
I read elsewhere that I had to disable constraints to resize the Form, so I tried code below.
let tableView = NSTableView()
tableView.translatesAutoresizingMaskIntoConstraints = false
let newRect = NSRect(x: 100, y: 0, width: 1100, height: 600)
myWindow?.setFrame(newRect, display: true)
That code did not seem to do anything as well.
Also, the Form displays in the lower left of the screen.
Note that main reason I want to resize the Form after loading is to keep it smaller during design development. The same goes for the NSTableView, which I have not gotten to yet.
Hi.
Since Xcode 16 and/or iOS 18.0 (I upgraded at the same time), I have an strange effect in the lower (let's say) 20% section of the Navigation Bar when changing to another tab, and this independently if large titles are used or not. Mentioned section is brighter or darker than the rest of the Navigation Bar background, depending on which background tint is used. This effect lasts about 0.3 seconds, but is clearly visible, quite disturbing and new as of Xcode 16 and/or iOS 18.0.
I use the code below in AppDelegate to get a gradient coloured Navigation Bar background.
let appearance = UINavigationBarAppearance()
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
UINavigationBar.appearance().compactScrollEdgeAppearance = appearance
If I don't use above code., the background color is filled and without gradient. Subject effect doesn't show in this case.
The effect basically looks like when changing tab, the new Navigation Bar background doesn't clear right away, and keeps the background from the previous Navigation Bar for 0.3 seconds before new one Navigation Bar background is rendered.
I spent quite some time on changing every possible setting, in code as well as storyboard ... no success so far.
Any ideas how to disable this undesired animation?
If I put the phone flat on a table, the left and right swipe gestures is not working but up and down gestures works.
Only when I put the iPhone to some vertical degree, the left and right swipe works.
Tested on 2 iPhone 7 Plus and 2 iPhone 13.
Anyone has similar experience? If yes, why?
Hi everyone:
I'm experiencing an issue in iOS 26. I've implemented a custom ViewController. It's super simple to edit images with flip, crop, zoom in, and zoom out. My question is that it seems very strange to me. It works without problems in iOS 17.5 and iOS 18. However, when I try to run it with iOS 26, the entire ViewController seems disabled; it doesn't recognize touches or anything. When I checked the UI hierarchy, I saw a strange FloatingBarContainerView overlaying the entire ViewController.
I searched the documentation for information about this view, but I couldn't find anything. Any help on how to hide or remove this view in iOS 26? This hasn't been implemented anywhere.