I expected the initializer NLLanguage(rawValue: "...") to return nil if I gave it junk, but it doesn't. It accepts any string. I'm loading values from a database so I'd like to know if I'm getting one that is valid, like "en", "es", etc., as opposed to an error. Is there anyway to check that?
I'm using it to set NLLanguageRecognizer.languageConstraints, so I guess by "valid" I mean all the languages that work with that property.
The struct has a bunch of static constants:
struct NLLanguage {
static let english = ...
static let spanish = ...
...
}
If those all work with NLLanguageRecognizer I guess I can paste them all into a dictionary.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have an app that plays synthesized speech. If I call the AVSpeechSynthesizer speakUtterance method with a premium voice, then no noise comes out, and the synth never works again. However, if I first use a non-premium voice, it works, and I can then call it with premium voices and they speak too.
I need to get at the files of an app (one that I developed). It's sitting there on the home screen of my iPad, and I can run it. But in the "Devices and Simulators" window in Xcode, in the "Installed Apps" list, it's not there. That list is how I would normally get the "container" so I can see the files.
Why would an app that is obviously on the device not be in the list? Is there another way to get the container/files?
When I try to run my app on my iPhone, from Xcode, I get a popup that says Unable to Install "AppName". There is some text in the popup. Here's the first part of it. (I replaced the real app's name with "AppName".)
Anyone know how to fix this?
Unable to install "AppName"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
User Info: {
DVTErrorCreationDateKey = "2024-09-28 04:04:29 +0000";
IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}
--
Unable to install "AppName"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
--
Could not inspect the application package.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
User Info: {
DVTRadarComponentKey = 282703;
MobileDeviceErrorCode = "(0xE8000051)";
"com.apple.dtdevicekit.stacktrace" = (
...
I have a couple apps in one git repository. I'd like to have a Swift package in that repo as well, shared by apps. In other words, I don't want a separate repo for the Swift package. I followed the instructions here:
https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages
It seems to work. I can write code like this in my app:
import MyLocalPackage
func foo() {
myLocalPackageFunc()
}
I notice that the package is not listed under Project > MyApp > Package Dependencies. I don't really care, as long as I can reuse code between apps.
But when I try to add this package code to a 2nd app, I'm at a loss. I tried "Add Package Dependencies" and "Add Local", but that creates a different looking setup than the 1st app. The code is browsable in the project navigator. And when I try to build it says "Missing package product 'MyLocalPackage'.
The documentation linked above, which I used for the 1st app, does a "New > Package". I don't want a new package. How can I connect the existing one?
This method on UIEvent gets you more touch positions, and I think it's useful for a drawing app, to respond with greater precision to the position of the Pencil stylus.
Is there a similar thing in macOS, for mouse or tablet events? I found this property mouseCoalescingEnabled, but the docs there don't describe how to get the extra events.
I'd like to use the new localization screenshots and test plans feature to take screenshots in different languages, for the app store. I end up with images that are half one screen and half another, like it's some kind of timing issue. My test code is below. Is it missing something that would give it the right timing on the screenshots?I wrote a UI test and set "Localization Screenshots" to "On" in the test plan's settings. The UI test walks through a few screens and the resulting test report has a few image files attached labeled "Localization screenshot". Some images are are split so that the left side is one view controller and the right side is another, like it captured a push navigation transition. Another image has two overlaid screens, each half faded.I'm running in the simulator. My test code looks like: func testTakeScreenshots() {
let app = XCUIApplication()
app.launch()
// At workouts page
app.tables["workouts"].cells.element(boundBy: 0).tap()
// At first workout
app.navigationBars.buttons["edit"].tap()
// At workout edit screen, click first exercise
app.tables.cells.element(boundBy: 0).tap()
...
}
I have some code that used to run on my iPad Pro. Today I compiled it for iOS 13, with Xcode 11, and I get errors like this: validateComputeFunctionArguments:834: failed assertion `Compute Function(merge_layer): Shader uses texture(outTexture[1]) as read-write, but hardware does not support read-write texture of this pixel format.'The pixel format is showing as `MTLPixelFormatBGRA8Unorm`. That's what I expected.The debugger says the device has no support for writeable textures. (lldb) p device.readWriteTextureSupport (MTLReadWriteTextureTier) $R25 = tierNoneDid some devices lose support for texture writing in iOS 13?Rob
Hi,
I want something like sandbox-exec, so I can run things that I don't trust, and restrict their ability to read or write files to only certain locations. Like most software devs I have to download and run lots of code from the internet and the danger of this really annoys me.
Unfortunately sandbox-exec is marked as deprecated and the APIs in sandbox.h say "No longer supported".
I notice there is some new stuff in the Apple docs about "hypervisors" and "virtualization".
https://developer.apple.com/documentation/hypervisor
https://developer.apple.com/documentation/virtualization
Would these APIs allow me to start and control a virtual copy of my macOS, to serve like a sandbox?
Are there other solutions that people use?
As an example, say that I need to download and run a copy of memcached. It's a typical open source project – you unpack a source tgz, then run configure; make and get a binary. Now I want to run that without worrying that some hacker injected a piece of evil code to copy my files and send them somewhere. So I want to say "run this binary, while disallowing file reads and writes, except for directories X,Y,Z, and disallowing network connections, except for listening on port 1234."
Hi,
If I change the AppIcon in Xcode's Assets.xcassets, and rerun my app, the image used in the dock and app switcher does not update. If I "Clean Build Folder", and re-run, then it updates.
This is annoying when I keep tweaking the colors in the icon and want to see how they look. A full rebuild takes a while, because I have a few Swift Package dependencies.
Anyone know a trick to get the AppIcon to stop caching (or whatever it's doing)?
I tried killall Dock and killall Finder, but that didn't help.
(macOS 11.2.3)
Rob
I have a TextField in my toolbar that I use for a search function. I want to trigger the search by hitting the "return" key in this field. But if I do it in onCommit, the search also gets triggered when the user un-focuses the field.
Is there a way to respond to just the "return" key?
TextField("Search", text: $searchQuery) { editing in
print("onEditingChanged \(editing)")
} onCommit: {
// Problem: this is triggered by both
// 1. Return key
// 2. Losing focus
searchModel.startSearch(query: searchQuery)
}
I've been using the os.Logger API, but it looks like I need to create an OSLog as well if I want to use the signpost API for tracking performance.
Is that true, or is there some way get an underlying OSLog from a Logger? Then I could write something like:
swift
extension os.Logger {
func signpost(...) {
os_signpost(.begin, ... self.osLog, ...)
}
}
You used to be able to put two wheel Pickers side-by-side in an HStack, if you used .frame(...) to set the width, along with .clipped().
Example code from previous question here: https://developer.apple.com/forums/thread/127028
HStack(spacing: 0) {
Picker(selection: $choice1, label: Text("C1")) {
ForEach(0..<10) { n in
Text("\(n) a").tag(n)
}
}
.pickerStyle(.wheel)
.frame(minWidth: 0)
.clipped()
// repeat with second Picker
}
This is not working for me now in iOS 15. The views still appear side by side, but the touch area seems to overlap. When you try to adjust the first wheel, it spins the second one. I can move the first wheel, if I touch way over to the leading side of the screen.
(I had to add the explicit Picker style. It seems like defaulting to .menu also started in iOS 15. ?)
I want to show a custom confirmation dialog on my iPad. It pops up looking utterly ridiculous because the size is way bigger than it needs - inches of padding on all sides.
Is there still no way to control a sheet size on iPad?
Example code:
struct ContentView: View {
@State var showSheet = false
var body: some View {
Button("Show sheet") {
showSheet = true
}.sheet(isPresented: $showSheet) {
VStack(spacing: 0) {
Text("Title")
Divider()
Text("Line 1")
Text("Line 2. Blah blah blah blah.")
Divider()
HStack {
Button("Cancel") { showSheet = false }
Divider()
Button("OK") { showSheet = false }
}.fixedSize(horizontal: false, vertical: true)
}
.frame(minWidth: 0, minHeight: 0)
.fixedSize()
}
}
}
The result: