Does anyone use the new hierarchical data List (ie, OutlineGroup) with a model where the tree data changes?
I'm on Big Sur beta. I have code like this:
List([treeRoot], children: \.children) { item in ...
Say the treeRoot (observed object) gets a new child. The view tries to re-render and fails:
2020-09-21 ... [General] NSOutlineView error inserting child indexes <_NSCachedIndexSet: 0x600000760000>[number of indexes: 1 (in 1 ranges), indexes: (3)] in parent 0x0 (which has 1 children).
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
If I purchase a product with a test session in my unit test, everything works as expected. I see a purchased transaction on my payment queue.
But if I set the property to make it fail, nothing happens. Shouldn't I observe a transactions with transactionState == .failed?let session = try! SKTestSession(configurationFileNamed: "Configuration")
session.disableDialogs = true
session.clearTransactions()
session.failTransactionsEnabled = true
session.failureError = .unknown
session.buyProduct(productIdentifier: productID)
Has anyone used this?
This observer normally gets called. But not when I set failTransactionsEnabled. public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
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, ...)
}
}
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.
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:
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.
Why the does this display "Hello1" and not "HelloWorld"? Then if I put a space between them it works as expected.
(macOS 12.0.1)
struct ContentView: View {
var body: some View {
let t1 = Text("Hello").foregroundColor(.red)
let t2 = Text("World").foregroundColor(.blue)
Text("\(t1)\(t2)")
.padding()
.frame(width: 200)
}
}
Is this a bug? Is the < character supposed to change something in markdown? I didn't think so.
(Xcode 13.1)
I watched a WWDC talk on LLDB, and they showed a nice trick of calling CATransaction.flush() from the debugger, to push changes to a UIView to the screen, even when the program was paused. Is there is a similar thing we can do with Metal?
I'm using MTKView, but I can change to a lower level if that's required. The MTKView is paused, so I'm using setNeedsDisplay. As usual, I implement the draw delegate method to encode and commit a command buffer.
If I do this from LLDB:
metalView.setNeedsDisplay()
CATransaction.flush()
I can see that causes my draw function to run, but nothing shows up on screen.
Is there something else we can do to flush those metal commands to the GPU and see them on screen while stepping through the program with the debugger?
I can't debug my metal shaders anymore. The GPU button just says this:
I have a lot of metal code so I'm not sure what triggered it. The "?" button does nothing.
Any pointers on where to look? Are there certain APIs that do this?
My project builds after a clean, but then fails to build. I can't understand these error messages. I have a macOS app target ("MyArchives") and a library target ("HelpPG") in the project. The app uses the library. Logically, there is no cycle.
The library is an attempt to wrap PostgreSQL's libpq with some Swift stuff. It works when it runs after the clean build.
I don't know what it's talking about with "headers before sources". That is already the case for the library target. There are no headers in the app target (which is all Swift).
For readability, strings were substituted:
[DEBUG] = /Users/me/Library/Developer/Xcode/DerivedData/MyArchives-flyvnqgqeolefjeztyopfnoaqmaj/Build/Products/Debug
[UUID1] = bb030422ec80ba11076c24bcbd7fcd674d61e6313e2915ec58f3544977cb99a4
[UUID2] = bb030422ec80ba11076c24bcbd7fcd67db6f662ae7c65be0e231d735b4905dc3
Showing All Messages
Cycle in dependencies between targets 'MyArchives' and 'HelpPG'; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle path: MyArchives → HelpPG → MyArchives
Cycle details:
→ Target 'MyArchives' has copy command from '[DEBUG]/libHelpPG.dylib' to '[DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib'
→ Target 'HelpPG' has link command with output '[DEBUG]/libHelpPG.dylib'
○ Target 'HelpPG' has copy command from '/usr/local/pgsql/lib/libpq.5.13.dylib' to '[DEBUG]/libpq.5.13.dylib'
○ Target 'HelpPG' has link command with output '[DEBUG]/libHelpPG.dylib'
Raw dependency cycle trace:
target: ->
node: <all> ->
command: <all> ->
node: [DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib ->
command: target-MyArchives-[UUID1]-:Debug:PBXCp [DEBUG]/libHelpPG.dylib [DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib ->
node: [DEBUG]/libHelpPG.dylib/ ->
directoryTreeSignature: ~ ->
directoryContents: [DEBUG]/libHelpPG.dylib ->
node: [DEBUG]/libHelpPG.dylib ->
CYCLE POINT ->
command: target-HelpPG-[UUID2]-:Debug:Ld [DEBUG]/libHelpPG.dylib normal ->
node: [DEBUG]/libpq.5.13.dylib ->
command: target-HelpPG-[UUID2]-:Debug:PBXCp /usr/local/pgsql/lib/libpq.5.13.dylib [DEBUG]/libpq.5.13.dylib ->
node: <target-HelpPG-[UUID2]--phase1-compile-sources> ->
command: Gate target-HelpPG-[UUID2]--phase1-compile-sources ->
node: <Linked Binary [DEBUG]/libHelpPG.dylib> ->
command: target-HelpPG-[UUID2]-:Debug:Ld [DEBUG]/libHelpPG.dylib normal
I have a UIScrollView, and its subview inside needs to respond to some touchesMoved events without scrolling. I've got it mostly working, but with one sticking point that confuses the user: if I touch and quickly move my finger, then the UIScrollView takes the gesture as a scroll, and never calls the touchesBegan, touchesMoved, etc., of its subview. However, if I touch, then pause for a bit, then drag, then things work as intended: the subview gets touchesBegan, touchesMoved, etc., and things are handled without any scrolling.
On my UIScrollView, I've set:
delaysContentTouches = false
canCancelContentTouches = true
And I've overrode touchesShouldCancel(in view: UIView). But that does not get called in the case when I quickly drag my finger.
Is there something else I need to do?
It's a simple question. I'm just trying to understand how these things fit together. Core Text doesn't seem to get updated much, but maybe that's because it's low level and doesn't need it. I assume it's still the recommended way to do low-level text things not handled by TextKit. ?
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])
}
}
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)