Posts

Post not yet marked as solved
4 Replies
2.9k Views
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
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
1 Replies
587 Views
I created a simple app in Xcode. Installed and ran it in the iOS Simulator. I can also start it from command line like this: % xcrun simctl launch booted com.example.TestBuildCommands --console com.example.TestBuildCommands: 52877 % It just prints that one line and returns my shell prompt. But the help for launch says that --console should: "Block and print the application's stdout and stderr to the current terminal." In my main() function I have: int main(int argc, char * argv[]) { printf("In main.\n"); ... Shouldn't I be seeing that message in my terminal screen? % xcrun simctl help launch Launch an application by identifier on a device. Usage: simctl launch [-w | --wait-for-debugger] [--console|--console-pty] [--stdout=<path>] [--stderr=<path>] [--terminate-running-process] <device> <app bundle identifier> [<argv 1> <argv 2> ... <argv n>] --console Block and print the application's stdout and stderr to the current terminal. Signals received by simctl are passed through to the application. (Cannot be combined with --stdout or --stderr) [...] ps. Anyone know how to turn off syntax highlighting in those triple-backquoted code blocks that are meant to be just terminal text, not highlighted code?
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
1 Replies
980 Views
I have a button to restore purchases in my app. It calls AppStore.sync() as suggested by sample code. I'm testing in the sandbox, I put my device in airplane mode, and it throws StoreKitError.userCancelled. That's odd. Anyone else see this? I'd like to show an error alert popup to the user here, but I can't differentiate between this an a real userCancelled.
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
0 Replies
394 Views
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?
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
8 Replies
5.4k Views
Hi,I need to save and load metal textures to a file. Example code below is below. I'm noticing the RGB values are changing as it gets saved and reloaded again.metal texture pixel: RGBA: 42,79,12,95after save and reload: 66,88,37,95I thought it might be a colorspace issue, but the colorspaces I’ve tried all had the same problem. `genericRGBLinear` got close, but there’s got to be a way to save the RGB data and get it back exactly. ?thanks,RobCode:// saving... let ciCtx = CIContext() let ciImage = CIImage(mtlTexture: metalTexture, options: [:]) [ … transfrom to flip y-coordinate …] let colorSpace = CGColorSpaceCreateDeviceRGB() let cgImage = ciCtx.createCGImage(ciImage, from: fullRect, format: kCIFormatRGBA8, colorSpace: colorSpace)! let imageDest = CGImageDestinationCreateWithData(mData, kUTTypePNG, 1, nil)! CGImageDestinationAddImage(imageDest, cgImage, nil) CGImageDestinationFinalize(imageDest) // loading... let src = CGImageSourceCreateWithData(imgData, nil) let img = CGImageSourceCreateImageAtIndex(src, 0, nil) let loader = MTKTextureLoader(device: self.metalDevice) let texture = try! loader.newTexture(cgImage: img, options: [:])
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
0 Replies
639 Views
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.
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I've added an NSTrackingArea to my NSView because I want a certain rectangular area to show a different cursor. As expected, my view gets a call to it's cursorUpdate:(NSEvent*) method, but how do I tell whether it's an "enter" or "leave". - (void)cursorUpdate:(NSEvent *)event { // Do I push or pop my custom NSCursor? } I notice the event.modifierFlags changes from 8 to 9. But I don't see any public enum constants to test that, so I don't know if I can depend on that. The public enum contains stuff like this, in the higher bits. typedef NS_OPTIONS(NSUInteger, NSEventModifierFlags) { NSEventModifierFlagCapsLock = 1 << 16, NSEventModifierFlagShift = 1 << 17, ... The tracking area setup code: NSRect nsRect = ... NSTrackingAreaOptions options = NSTrackingCursorUpdate | NSTrackingActiveInKeyWindow; NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect: nsRect options: options owner: owner userInfo: userInfo]; [myView addTrackingArea: trackingArea];
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
3 Replies
1.2k Views
Does anyone use this? I can't get it working. I'm talking about code in normal swift files, not playgrounds.Example:/// ![testdiagram](/Users/me/fullpathto/test-image.png) /// ![test xcode image](http://devimages.apple.com.edgekey.net/assets/elements/icons/128x128/xcode.png) ///Neither one displays anything in the documentation popover or the Quick Help Inspector.The docs act like it works: https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/Images.html#//apple_ref/doc/uid/TP40016497-CH17-SW1A lot of my code would really benefit from diagrams in documentation. I'd love to be able to use this.
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
1 Replies
843 Views
Is there a way to quickly confirm a "fix-it" popup using only the keyobard? The "Fix Next Issue" and "Fix Previous Issue" commands just show the popup. I still have to manually press the "Fix" button. Return key simply dismisses the popup. Clicking that tiny button 1000's of times is annoying. Xcode 12.4. In IntelliJ I can fly through these with a nice keyboard shortcut. I'm looking for a similar thing in Xcode.
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
In SwiftUI on macOS, you can add items to the main menu by using things like CommandGroup, CommandMenu. But the default menus already have items. For example, the Edit menu has Undo, Redo, Cut, Copy, Paste, Delete, Select All. Those menu items are grayed out and don't do anything. Is there a way to hook some Swift code to these? Or do you just use CommandGroup(replacing: ...) to replace them? That doesn't seem right; why put them there if you just have to replace them? Besides hooking up a function to run when they get clicked, I'd like to know how to enable and disable them depending on app state.         WindowGroup {             MyContentView()         }.commands {             SidebarCommands()             CommandGroup(after: .newItem) {                 Button { newFolder() } label: { Text("New Folder") }                     .keyboardShortcut("n", modifiers: [.command, .option])             }         }
Posted
by rnikander.
Last updated
.
Post marked as solved
1 Replies
974 Views
If I go to the Xcode documentation viewer and type simd_float3x3 in the search field, nothing comes up. I swear these things used to have documentation. Where is it? Is it a bug? (Xcode 13.4.1)
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
0 Replies
929 Views
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.
Posted
by rnikander.
Last updated
.
Post not yet marked as solved
3 Replies
1.4k Views
This appears to severely limit the usefulness of hierarchical lists in SwiftUI. I want to use the new hierarchical list/outline to display a filesystem tree. For data to pass to OutlineGroup, I created a class named FileSystemNode, and gave it a computed children property. When the getter is first called, it will read its directory contents to return a list (if it is a directory). Problem is, when the OutlineGroup is first displayed, even though it is collapsed on-screen to a single node, it calls children and recurses over the entire filesystem. Is there a way to stop this? If not, I hope it gets fixed before release. (This is on macOS Big Sur beta)
Posted
by rnikander.
Last updated
.