I’m writing an app that, among other things, displays very large images (e.g. 106,694 x 53,347 pixels). These are GeoTIFF images, in this case containing digital elevation data for a whole planet. I will eventually need to be able to draw polygons on the displayed image.
There was a time when one would use CATiledLayer, but I wonder what is best today. I started this app in Swift/Cocoa, but I'm toying with the idea of starting over in SwiftUI (my biggest hesitation is that I have yet to upgrade to Big Sur).
The image data I have is in strips, with an integral number of image rows per strip. Strips are not guaranteed to be contiguous in the file. Pixel formats vary, but in the motivating use case are 16 bits per pixel, with the values signifying meters. As a first approximation, I can simply display these values in a 16 bpp grayscale image.
Is the right thing to do to set up a CoreImage pipeline? As I understand it that should give me some automatic memory management, right?
I’m hoping to find out the best approach before I spend a lot of time going down the wrong path.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Is there documentation describing the semantics of a Metal CIKernel function?
I have image data where each pixel is a signed 16-bit integer. I need to convert that into any number of color values, starting with a simple shift from signed to unsigned (e.g. the data in one image ranges from about -8,000 to +20,000, and I want to simply add 8,000 to each pixel's value).
I've got a basic filter working, but it treats the pixel values as floating point, I think. I've tried using both sample_t and sample_h types in my kernel, and simple arithmetic:
extern "C"
coreimage::sample_h
heightShader(coreimage::sample_h inS, coreimage::destination inDest)
{
coreimage::sample_h r = inS + 0.1;
return r;
}
This has an effect, but I don't really know what's in inS. Is it a vector of four float16? What are the minimum and maximum values? They seem to be clamped to 1.0 (and perhaps -1.0). Well, I’ve told CI that my input image is CIFormat.L16, which is 16-bit luminance, so I imagine it's interpreting the bits as unsigned? Anyway, where is this documented, if anywhere (the correspondence between input image pixel format and the actual values that get passed to a filter kernel)?
Is there a type that lets me work on the integer values? This document - https://developer.apple.com/metal/MetalCIKLReference6.pdf implies that I can only work with floating-point values. But it doesn't tell me how they're mapped.
Any help would be appreciated. Thanks.
In my macOS SwiftUI app I have a list of "layers" on the left. Clicking on a layer focuses it on the right for acting upon. Each link has a little eye icon that's used to toggle visibility of that layer in the view to the right.
I'd like to be able to click on that eye button without selecting the layer or activating it. Is that possible?
As of 11.3, DocumentGroup defaults to showing the open panel (From the release notes: "DocumentGroup apps now show an Open panel on launch, even when iCloud isn’t in use. (66446310).") Seems like it was considered a bug before that it didn't.
Thing is, I don't like this behavior and don't want it, especially while I'm working on my app. I want to automatically create a new document. Is there any way to set that?
As in the locked question here - https://developer.apple.com/forums/thread/674534, I'm constantly running into this error:
Compiling failed: 'main' attribute cannot be used in a module that contains top-level code
Once it starts, it's not clear how to stop it. No changes were made to my AppDelegate (It's a mostly-UIKit app that I'm adding some SwiftUI views to).
It compiles just fine with a regular build, but the SwiftUI preview can't build it. This is proving to be a real hindrance.
I can sometimes clear the condition by cleaning build and test results, and relaunching Xcode. But not always.
I filed FB9104575 and included the diagnostics.
I just created a new macOS app project in Xcode 13 beta. SwiftUI, unit tests, no Core Data.
I just noticed that it does not add the traditional "Products/MyApp.app" group and file, and I can't figure out how to add those via the UI.
At least one solution online edits the pbxproj file directly; I'd rather not do that.
Is there any sanctioned way to add this? Is not having it a bug?
I recently created a new app record in AppStoreConnect. The app is still in development and testing, so we use this for TestFlight builds. The app has a complete app icon internally, and shows up in the Simulator and devices correctly.
But in AppStoreConnect, it shows the generic app icon placeholder.
I contacted Apple support about this, and they told me I needed to include the app icon in the app. I told them I already do, and showed them the screenshots. They basically said sorry, not my problem, try the dev forums.
So here I am.
Is there a way I can set my own app to be the default web browser on macOS? The System Preferences->General UI for choosing the default web browser doesn't have an obvious way to set an arbitrary app. Is there a way to configure my app so that macOS recognizes it as an option for this list?
How do I handle URLs in a SwiftUI app? The only thing I can find is to put onOpenURL in my App's WindowGroup view content, but that makes a new window for every URL that gets handled.
When stepping through code in the Xcode debugger, hovering over a variable in the context causes a little popover to appear, displaying the value of that variable.
Is there any way to disable this behavior? I find it gets in the way and I never use it.
I have a SwiftUI app made up of two types of window. If I hold the option key while clicking in the close box of one window, it closes all the app windows.
I want to change that behavior to just close all the windows of a particular type (or use any other criteria, for that matter). Is this even possible?
I'm using Settings to implement the preferences in macOS, with a TabView. Runs fine, but in Xcode preview, it renders the buttons differently. Clearly Settings is applying some kind of button style (or TabView knows it needs to change), but how can I get this to work in a preview? I can't preview Settings directly.
Is there any way to get Xcode to render a macOS settings view hierarchy as if it were in a Settings window? I have a TabView at the top of my Settings hierarchy, but in Xcode’s preview, it shows the tab as a simple text-only button:
instead of the icon it looks like when running:
I'm working on a SwiftUI client app for my web service. A logged-in user can belong to one or more Organizations, and in the app's settings UI, the user can change which organization is the current selectedOrg. The selected org is displayed using a Picker view in the settings UI. The Model is made available to the UI primarily through @EnvironmentObject.
When the user changes the selectedOrg, the app has to fetch some data (a set of Machine records) and set the result in the model. I see at least two ways to do this.
A) Use @State in the SwiftUI view, initialized with the current selectedOrg in the model, and .onChange(of:) that state to then call a method that sets the new org and starts the relevant data fetch.
B) Bind to the selectedOrg in the model, and use willSet/didSet inside the model to initiate the network request.
The latter option feels better, because it pulls a lot of the logic out of the views and into the model/business logic.
What are your thoughts on this?
I have a multi-timezone clock displayed in a very thin window I like to put up on top of my menu bar or in the empty space to the left or right of the notch (when my laptop is not the primary display). There's no issue moving it there, but every time the screens reconfigure, macOS moves my window down out of that area.
Is there any way to exempt an NSWindow (or a SwitUI window) from this repositioning behavior?