Post

Replies

Boosts

Views

Activity

FileDocument - open another file in the same directory as selected file
I'm working on a macOS app where my file format can include other files (think #include in C/C++). When opening a file with SwiftUI's document-based APIs (i.e., FileDocument), is there a way to get access to those other files? Alternatively, is there a way I could "open" the file's directory, similar to how Xcode opens the directory that a .xcodeproj is located? I don't mind falling back to older Cocoa APIs if this is too obscure for the shiny new stuff :)
3
0
818
Mar ’24
What does transaction(block:) actually do?
I'm working on an app where I want to add a large amount of data to SwiftData, but roll back if any errors occur during this process. SwiftData has a method called transaction (linked below), but it does not have any documentation and I can't find any info about it online. What does it actually do? https://developer.apple.com/documentation/swiftdata/modelcontext/transaction(block:)
0
1
412
Aug ’23
Setting the user's keyboard to another language
I'd like to change the keyboard language for a TextField to Japanese, similar to how the Translate app can set the keyboard to the language being inputted. Is it possible to do that in SwiftUI, or is setting an arbitrary language not a public API? I've seen a few posts about suggesting that it's possible to do so in UIKit with UITextInputMode, but even then you can only use languages that the user has set.
0
1
332
Jul ’23
Thread 1: "Model already contains an entity named <member>."
I'm trying to store a few classes using SwiftData, but I am getting the error mentioned in the title. The classes I'm trying to store can be found at https://github.com/jmshrv/wanikani-swift/blob/swiftdata/Sources/WaniKani/Models/Subject.swift. Specifically, I'm trying to store the Radical, Kanji, Vocabulary, and KanaVocabulary types. I think this issue has something to do with the classes having members with the same name and data type, but I can't reproduce this, so that mustn't be the case. Has anyone else run into this?
2
0
696
Jul ’23
What Audio Codecs do iOS Support?
I'm working on a music app where I need to set supported formats in a request to the server (to check if transcoding will be required). The best resource I can find is on the old documentation page for OS X 10.5 - https://developer.apple.com/library/archive/documentation/MusicAudio/Conceptual/CoreAudioOverview/SupportedAudioFormatsMacOSX/SupportedAudioFormatsMacOSX.html Is there an updated resource for iOS?
1
0
1.4k
May ’22