Is there a way to opt certain windows out of tiling in macOS 15?
I'm supporting a beloved feature called App Veil[1], which places windows below others that are not owned by the host application. These windows are passive: they don't allow mouse events and cannot be resized or moved.
With the new tiling feature on macOS 15, the window manager will rearrange these windows if you choose an arrangement option (such as Arrange Left & Right).
Ideally, I'd like to opt out of this behavior altogether for these windows, but I couldn't find a way to do that. The only thing I've found was that I could set a high window level, but that's not really an option as it's important to preserve the ordering so that the windows are directly below the out-of-process windows.
1: https://tuple.app/app-veil
Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.
Post
Replies
Boosts
Views
Activity
When I start a workout in my app, the system shows a Live Activity in the Smart Stack like in the picture. My app opens if I tap on it, but the pause and resume buttons doesn't do anything.
I have implemented the PauseWorkoutIntent and ResumeWorkoutIntent which works with the Action Button. I guessed that these would be used from this Live Activity as well, but it seems like not.
Has anyone successfully integrated with this? I haven't seen it documented anywhere, although I think it was already included in watchOS 10.
This is also shown when using the built in workout app and for that the buttons work as expected.
In control VPN icon, it’s always on ( showing on) even if I’m not active the VPN.
please find attachment
we found new crash about UIFont since iOS 18 beta published.This crash never occurred on previous operating system. Can anyone give the answer that how to fix it and tell whether later beta version might fix it.
Hi All, this question has been asked before by others, without any success so far.
I'm using the following (standard) method to open the system provided settings screen for my macOS (only) app in SwiftUI.
var body: some Scene {
Settings {
PreferencesView()
}
if #available(macOS 13, *) {
// MenuBarExtra requires macOS 13, but SettingsLink used in here requires macOS 14
MenuBarExtra("...", image: "...") {
...
// this one requires macOS 14
if #available(macOS 14, *) {
SettingsLink() {
Text("Settings...")
}
} else {
Button {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} label: {
Image(systemName: "gear")
}
}
}
}
}
I want to know when the settings window closes. onDisappear does not work as the settings window is not really closed, but hidden. So the view stays active. All other hacks I have found neither work.
Does anyone have any idea?
In iOS, I'm trying to do multiple (upwards of 10) screen snapshots (UIImages) per second to be combined into a video and am running into some challenges.
UIView's drawHierarchy seems to be to slow when run on the main thread, causing jitter with the UI experience. I've noticed that I can run it on a background thread, but only when passing a value of FALSE for the afterScreenUpdates parameter. This does cause the main thread warning to be written to the console (when the main thread checker is turned off), but does work. And I don't have to worry about blocking the main thread as it is on a background thread.
The question is, will running drawHierarchy on the background thread potentially cause memory corruption when traversing the entire tree of a UIWindow.
And if so, what is the advised most performant method of capturing iOS screenshots?
drawHierarchy Doc:
https://developer.apple.com/documentation/uikit/uiview/1622589-drawhierarchy
TIA
I have a project with two local packages
One client package with an interface and some models with dynamic type in the Package.Swift
One feature package with the UI and a dependency to the client package
When I try to preview a view that is not using any models or code from the client package, it loads just fine e.g. a view that is just a container to display things like a card
But when I tried to preview any other view that actually uses models from the client package, it just fails
the first few lines of the preview error display
LinkDylibError: Failed to build <filename>.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: search path '/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks-iphonesimulator' not found
Undefined symbols for architecture arm64:
Also, I'm using Xcode 15.4 and iOS 17 as the min version
Hi All,
I really need your help, I have been racking my brain to work out why, after a push notification triggers a fetchdata function from the server, my new bookings dont dynamically update the counter against the booking types.
print("Received remote notification: \(userInfo)")
if let dataInfo = userInfo["data"] as? [String: Any],
let jsonData = try? JSONSerialization.data(withJSONObject: dataInfo) {
print("Processing data from notification...")
DispatchQueue.main.async {
self.eventsViewModel.updateFromPushNotification(data: jsonData) { result in
completionHandler(result)
}
}
} else {
print("Failed to parse notification data")
completionHandler(.noData)
}
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("Failed to register for remote notifications: \(error)")
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
print("Will present notification: \(notification.request.content.userInfo)")
DispatchQueue.main.async {
self.eventsViewModel.fetchData()
}
completionHandler([.banner, .badge, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
print("Did receive notification response: \(response.notification.request.content.userInfo)")
let userInfo = response.notification.request.content.userInfo
if let fetchNeeded = userInfo["fetchNeeded"] as? Bool, fetchNeeded {
print("Initiating data fetch due to user interaction...")
DispatchQueue.main.async {
self.eventsViewModel.fetchData()
}
}
completionHandler()
}
@Published var bookings: [AnyBooking] = []
@Published var newBookings: [AnyBooking] = []
@Published var calendarBookings: [String: [AnyBooking]] = [:]
@Published var selectedBooking: AnyBooking?
private var cancellables = Set<AnyCancellable>()
private let calendarManager = CalendarManager.shared // Add calendarManager
func fetchData() {
guard let url = URL(string: "https://allsound.wisewms.uk/webhook_get") else {
print("Invalid URL for webhook request")
return
}
var request = URLRequest(url: url)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { [weak self] (data, response, error) in
guard let self = self else { return }
if let error = error {
print("Error fetching data: \(error.localizedDescription)")
return
}
if let data = data, !data.isEmpty {
if let newBookings = self.processBookings(data: data) {
DispatchQueue.main.async {
self.bookings = newBookings
self.separateAndOrganizeBookings(bookings: newBookings)
}
} else {
print("Failed to process bookings.")
}
} else {
print("No data received from server.")
}
}
task.resume()
}
@main
struct AllSoundApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject var eventsViewModel = EventsViewModel()
@Environment(\.scenePhase) var scenePhase
@AppStorage("selectedTheme") private var selectedTheme: Theme = .system
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(eventsViewModel)
.environmentObject(appDelegate.navigationCoordinator)
.preferredColorScheme(selectedTheme.colorScheme)
.onChange(of: scenePhase) { oldPhase, newPhase in
if newPhase == .active {
eventsViewModel.fetchData()
}
}
}
}
}
I have started to work on adding Live Activities to my app in watchOS 11. The app already has interactive Live Activities on the phone that works as expected.
I have added a view for the activityFamily: small and it shows up as expected.
My problem is that buttons doesn't work. I use the Intent based button, and on the iPhone Lock Screen they work. On the watch, nothing happens.
Has anyone got this working? Not sure if I'm missing something or if it's a bug.
We encountered a deadlock scenario when our app runs on iOS 18. It happens when we use the async version of UICollectionViewDiffableDataSource.apply() and request a section snapshot from within the UICollectionViewCompositionalLayoutSectionProvider.
The deadlock doesn't happen when using the completion handler version of UICollectionViewDiffableDataSource.apply() or when requesting a full snapshot from the data source.
On iOS 17 there is no issue.
import UIKit
class ViewController: UICollectionViewController {
private enum SectionIdentifier: Hashable {
case test
}
private enum ItemIdentifier: Hashable {
case test(UUID)
}
private typealias Snapshot = NSDiffableDataSourceSnapshot<SectionIdentifier, ItemIdentifier>
private typealias SectionSnapshot = NSDiffableDataSourceSectionSnapshot<ItemIdentifier>
private typealias DataSource = UICollectionViewDiffableDataSource<SectionIdentifier, ItemIdentifier>
private lazy var dataSource: DataSource = {
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewCell, UIColor> { cell, _, color in
cell.contentView.backgroundColor = color
}
return DataSource(collectionView: collectionView) { [weak self] collectionView, indexPath, itemIdentifier in
return collectionView.dequeueConfiguredReusableCell(using: cellRegistration, for: indexPath, item: .red)
}
}()
override func viewDidLoad() {
super.viewDidLoad()
collectionView.dataSource = dataSource
collectionView.collectionViewLayout = UICollectionViewCompositionalLayout { [weak self] section, environment -> NSCollectionLayoutSection? in
// calling `UICollectionViewDiffableDataSource.snapshot(for:)` from the `UICollectionViewCompositionalLayoutSectionProvider` leads to deadlock on iOS 18
let numberOfItems = self?.dataSource.snapshot(for: .test).items.count ?? 0 // deadlock
// calling `UICollectionViewDiffableDataSource.snapshot()` causes no issue
// let numberOfItems = self?.dataSource.snapshot().numberOfItems(inSection: .test) ?? 0 // works
let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .absolute(100), heightDimension: .absolute(100)))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: .init(widthDimension: .fractionalWidth(1), heightDimension: .absolute(100)), repeatingSubitem: item, count: numberOfItems)
group.interItemSpacing = .fixed(5)
return .init(group: group)
}
var snapshot = Snapshot()
snapshot.appendSections([.test])
snapshot.appendItems([.test(UUID()), .test(UUID()), .test(UUID()), .test(UUID())])
// using the async wrapper `UICollectionViewDiffableDataSource.apply()` on any thread leads to deadlock on iOS 18
Task { await dataSource.apply(snapshot) } // deadlock
// Task { @MainActor in await dataSource.apply(snapshot) } // deadlock
// using `UICollectionViewDiffableDataSource.apply()` with completion handling causes no issue
// Task { dataSource.apply(snapshot) } // works
// dataSource.apply(snapshot) // works
}
}
Full example project at https://github.com/antiraum/iOS18_UICollectionViewDiffableDataSource_deadlock
I've been seeing warning like the following with my Apple Watch app:
=== AttributeGraph: cycle detected through attribute 140952 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
=== AttributeGraph: cycle detected through attribute 131640 ===
I've done some debugging with Instruments and Xcode, I've determined that its caused by adding a
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
Label("Stop", systemImage: "xmark")
}
}
to an item within my NavigationSplitView List Destination view.
To aid reproduction of this issue even more, I've verified the same warning occurs with the Apple sample code from the WWDC23 Backyard Birds app.
https://developer.apple.com/documentation/swiftui/backyard-birds-sample?changes=_9
If you take the Apple sample code, open it in Xcode 15.4 and run it in the Apple Watch WatchOS 10.5 simulator, then select the Bird Springs item, all is well.
If you then add the above toolbar code to the BackyardSummaryTab file at the bottom of the VStack, you'll see the same AttributeGraph issues I'm seeing in my app.
Is this a bug? I can't understand why adding a static ToolBarItem in WatchOS is causing this.
I've seen this issue in the simulator and also on device.
Since httpRequest body is ignored on WKWebView, I am trying to display a php page by fetching the data first, and displaying it.
func fetchData() {
URLSession.shared.dataTask(with: request) {(data, response, error) in
guard let data, let url = request.url else {
return
}
// pass the result to WKWebView
}.resume()
}
import Foundation
import SwiftUI
import WebKit
struct CustomWebView: UIViewRepresentable {
var url: URL
var data: Data
func makeUIView(context: Context) -> UIView {
return CustomUIWebView(url: url, data: data)
}
}
class CustomUIWebView: UIView {
let webView: WKWebView
init(url: URL,data:Data) {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
super.init(frame: .zero)
webView.load(data, mimeType: "text/html", characterEncodingName: "utf-8", baseURL: url)
addSubview(webView)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
webView.frame = bounds
}
The data contains the page that display several images, but it doesn't display any of the images in WKWebView.
Test and other components (such as checkmark button) have no problem, only images do.
Also, I confirmed it works fine on Safari.
So what is the issue here?
What am I doing wrong?
Is there any way to use outline disclosure sections in a UICollectionViewDiffableDataSource without having to make all apply(_ snapshot:) calls from the main thread?
Whenever I collapse or expand a section I get a warning about mixing main queue/off-main queue updates:
Warning: applying updates in a non-thread confined manner is dangerous and can lead to deadlocks. Please always submit updates either always on the main queue or always off the main queue
I understand what this means, but I am applying my section snapshots on a background queue to avoid interrupting the UI, it seems like the expand/collapse updates use the main queue and I cannot find any way to make it use the same queue as my other updates. Does this mean I must apply my own updates on the main queue now as well?
for some of us, iMessage has been our number on texting and calling app we use to connect with people but there this feature the app lacks which is, the ability to put a custom image in the background of the chat page like we can do on other websites, I wish Apple could address this request of mine.
I'm trying to convert my project to use Swift 6 with Complete Concurrency in Xcode 16 beta 1.
The project uses TipKit, but I'm getting compile errors when trying to use the TipKit Parameters feature. Here is an example of the type of error I'm seeing (Note that this code from https://developer.apple.com/documentation/tipkit/highlightingappfeatureswithtipkit):
struct ParameterRuleTip: Tip {
// Define the app state you want to track.
@Parameter
static var isLoggedIn: Bool = false
Static property '$isLoggedIn' is not concurrency-safe because it is non-isolated global shared mutable state.
Is there a new pattern for supporting TipKit Parameters in Swift 6 with Complete Concurrency enabled? There is no obvious suggestion for how to fix this.
The latest WWDC 2024 TipKit doesn't appear to have any solution(s).
Hello there,
I'm playing around with the new ControlWidget controls and I'd like to start a Live Activity from on of them like they did in the WWDC Session.
Is this only possible using push notifications or is there another way around to do so locally?
Thank you.
Hello,
If we have the following code:
import SwiftUI
struct ContentView: View {
@State private var usdAmount = 0.0
var body: some View {
VStack {
Text("Currency Form")
Form {
TextField("Dollar Amount", value: $usdAmount, format: .currency(code: "USD")) // 1
// TextField("Dollar Amount", value: $usdAmount, format: .number) // 2
.keyboardType(.numberPad)
}
Text("usdAmount = \(usdAmount)")
}
.padding()
}
}
When the line marked // 1 is left uncommented (the TF has a .currency() formatter applied) the behaviour of the TF is rather odd.
Upon display it shows US$0.00
Upon editing the value the US$ part remains. So if the user enters US$123 the value is not stored into the usdAmount property.
The User must delete all the existing text and enter e.g. 456.78 and then the value is stored to the usdAmount property.
When Line //1 is commented-out and line //2 is uncommented then the TF behaves correctly because the TF value is just 0 on first display.
Should we not use the .currency() format? Or am I using it wrong?
Thanks.
Hello there,
I'm playing around with the new ControlWidget controls and I'd like to know the best approach to launch a Live Activity using these.
It seems to be possible according to its WWDC session but my main question is: Is it only doable using push notifications?
Thank you.
In my project, I create a UITabbarController using the storyboard. Later, I change the images and title of the individual tabbar items in the code. This works with the new tabbar controller from iOS 18, with one exception: If the iPad switches to a horizontally compact mode and thereby triggers the old tabbar (at the bottom of the screen), the images and titles from the storyboard appear there, not the values changed in the code. Am I doing something wrong or is this a bug?
After 5 years, 6 releases, SwiftUI still miss fundamental feature, lock interface orientation by view (can be by container, modal, …).
Many apps for iPhone just want portrait orientation but in some cases needed a modal in lanscape for a photo viewer or video player. Interface orientation options in info.plist just don’t work because will lock all views in the app.