In my project, i want to add emoji to my video but emoji image becomes dark when add in hdr video, im trying to convert my emoji image to hdr format or create with hdr format but seems not work. I hope someone has experiences in this case could help me.
Swift
RSS for tagSwift is a powerful and intuitive programming language for Apple platforms and beyond.
Posts under Swift tag
67 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I use the iTunes Library framework in one of my apps, starting with macOS Sequoia 15.1 i can't create the ITLibrary object anymore with the following error:
Connection to amplibraryd was interrupted. clientName:iTunesLibrary(ITLibraryLoader)
Error connecting to the server via proxy object Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.amp.library.framework" UserInfo={NSDebugDescription=connection to service named com.apple.amp.library.framework}
configure failed: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.amp.library.framework" UserInfo={NSDebugDescription=connection to service named com.apple.amp.library.framework}
I created a new sandboxed macOS app, added the music folder read permission and it reproduced the error:
import SwiftUI
import iTunesLibrary
@main
struct ITLibraryLoaderApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
var body: some View {
Button("Load ITLibrary") {
loadLibrary()
}
}
func loadLibrary() {
do {
let _ = try ITLibrary(apiVersion: "1.0", options: .none)
}
catch {
print(error)
}
}
}
I restarted my developer machine and the music app with no luck.
I'm pretty new to Swift and SwiftUI. I'm making my first app for sorting a gallery with some extra features.
I was using my own iPhone for testing and just started testing my app on other Apple products.
Everything works fine on iPad Air M1, iPhone 15 Pro, iPhone 15 Pro Max, iPhone 13, iPhone XS (Simulator), and iPhone 11 Pro (Simulator). However, when I tried to show my app to a family member with an iPhone 11, I came across an issue.
Issue Description:
My app takes all photos from iPhone's native gallery, then you can sort it by some spesific filters and delete pictures. It just looks like the native gallery. (I can add photos later if needed) You can just scroll the gallery by swiping up and down. You can press the select button and start selecting pictures to delete.
I recently added a drag-to-select-multiple-pictures feature. This makes it feel more like the native iOS experience, eliminating the need to tap each picture individually.
However, on the iPhone 11, the moment you open the app, you can't scroll. Scrolling is completely locked. You can still select pictures by tapping or dragging, so it's not a touch area issue. The same issue persists on the iPhone 11 simulator.
And I think I found the problematic part in my (sadly messy) ContentView.swift file;
ScrollView {
RefreshControl(coordinateSpace: .named("refresh")) {
await viewModel.refreshMediaItems()
}
LazyVGrid(columns: gridColumns, spacing: UIDevice.current.userInterfaceIdiom == .pad ? 12 : 4) {
let items = viewModel.filteredItems(typeFilter: mediaTypeFilter, specialFilter: specialFilter)
ForEach(Array(zip(items.indices, items)), id: \.1.id) { index, item in
MediaThumbnailView(
item: item,
isSelected: selectedItems.contains(item.id),
viewModel: viewModel,
onLongPress: {
if !isSelectionMode {
toggleSelectionMode()
selectedItems.insert(item.id)
}
},
onTap: {
if isSelectionMode {
toggleSelection(item: item)
} else {
viewModel.selectItem(item)
}
}
)
.aspectRatio(1, contentMode: .fit)
.background(
GeometryReader { geometry in
let frame = geometry.frame(in: .named("grid"))
Color.clear.preference(
key: ItemBoundsPreferenceKey.self,
value: [ItemBounds(id: item.id, bounds: frame, index: index)]
)
}
)
}
}
.padding(.horizontal, 2)
.coordinateSpace(name: "grid")
.onPreferenceChange(ItemBoundsPreferenceKey.self) { bounds in
itemBounds = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0) })
itemIndices = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0.index) })
}
.gesture(
DragGesture(minimumDistance: 0)
.onChanged { gesture in
if isSelectionMode {
let location = gesture.location
if !isDragging {
startDragging(at: location, in: itemBounds)
}
updateSelection(at: location, in: itemBounds)
}
}
.onEnded { _ in
endDragging()
}
)
}
.coordinateSpace(name: "refresh")
}
you can see the .gesture(.... part. I realised that this DragGesture and ScrollView blocks each other (somehow only on iPhone 11)
highPriorityGesture also won't work.
When I change it with simultaneousGesture, scroll starts to work again.
BUT - since it's simultaneous, when multiple selection mode is activated, when I'm dragging my finger gallery also starts to scroll and it becomes a very unpleasant experience. After this issue I realised on native gallery iOS locks scroll when you are dragging for multiple selection and just when you release your finger you can scroll again even if the multiple selection mode is active.
I tried a million things, asked claude, chatgpt etc. etc.
Found some similar issues on stackoverflow but they were all related to iOS 18, not spesific to an iPhone. My app works fine on iOS 18 (15 Pro Max)
iOS 18 drag gesture blocks scrollview
Here are the some of the things I've tried: using highPriorityGesture and simultenousgesture together, tried to lock the scroll briefly while dragging, implement much complicated versions of these things with the help of claude, try to check if isSelectionMode is true or not
All of them broke other things/won't work.
Probably there's something pretty simple that I'm just missing; but iPhone 11 being the single problematic device confuses me. I don't want to mess too much with my already fragile logic.
I have spent a long time refactoring lots of older Swift code to compile without error in Swift 6.
The app is a v3 audio unit host and audio unit.
Having installed Sonoma and XCode 16 I compile the code using Swift 6 and it compiles and runs without any warnings or errors.
My host will load my AU no problem.
LOGIC PRO is still the ONLY audio unit host that will load native Mac V3 audio units and so I like to test my code using Logic.
In Sonoma with XCode 16...
My AU passes the most stringent AUVAL tests both in terminal and Logic pro.
If I compile the AU source in Swift 5 Logic will see the AU, load it and run it without problems.
But when I compile the AU in Swift 6 Logic sees the AU, will scan it and verify it passes the tests but will not load the AU. In XCode I see a log message that a "helper application failed to run" but the debugger never connects to the AU and I don't think Logic even gets as far as instantiating the AU.
So... what is causing this? I'm stumped..
Developing AUv3 is a brain-aching maze of undocumented hurdles and I'm hoping someone might have found a solution for this one. Meanwhile I guess my only option is to continue using the Swift 5 compiler.
(appending a little note just to mention that all the DSP code is written in C/C++, Swift is used mainly for the user interface and also does some offline thready work )
Hi,,
How can I make a rectangle become taller as I swipe down on my trackpad?"
struct BlueRectangleView: View {
var body: some View {
VStack {
Rectangle()
.fill(Color.blue)
.frame(width: 200, height: 100)
.cornerRadius(10)
.shadow(radius: 5)
.padding()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.white)
}
}
struct BlueRectangleView_Previews: PreviewProvider {
static var previews: some View {
BlueRectangleView()
}
}
Hi,
I'm trying to implement WeatherKit for the first time and I am seeing this error when calling for the weather:
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
and
Encountered an error when fetching weather data subset; location=<+51.57750785,-2.08241362> +/- 6.55m (speed -1.00 mps / course -1.00) @ 11/01/2025, 11:50:45 Greenwich Mean Time, error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
I have:
Enabled the WeatherKit capability in my iOS app in XCode
Added Weatherkit to the AppID in the developer portal
Any suggestions what else I can check?
I'm running iOS 18.2.1 on 15 ProMax with XCode 16.2
The app I'm making uses the CallDirectory extension to identify callers.
Where is the contact data added by "func addIdentificationEntry" in "CallDirectory Extension" stored?
The app calls "CXCallDirectoryManager.sharedInstance.reloadExtension" and adds contact data by processing "CXCallDirectoryExtensionContext.addIdentificationEntry" written in "func beginRequest" of "CallDirectory Extension".
I thought that if I uninstalled the app, I would lose the contact data that added by App.
However, when I uninstalled the app and reinstalled it, it seemed to retain contact data that added by App before I uninstalled the app,
even though the app hasn't added any contact data yet.
Will the contact data added to the "CallDirectory Extension" be retained on iPhone even after uninstalling the app?
---Note---
I found a similar post on the forum about contact data added by addIdentificationEntry.
・CallKit - addIdentificationEntry is it secure?
[https://developer.apple.com/forums/thread/662182]
Answer of this post that "the added data is cached in a SQLite database",
but I couldn't find any official Apple documentation on this, so I'm not sure if this is correct.
If contact data is cached in SQLite, will that data remain on the iPhone when uninstalled and not deleted?
●Development environment
Mac OS Sonoma 14.7.1
Xcode 16.0
Swift
●Test Device
iPhoneSE3
iOS:17.6.1