Post

Replies

Boosts

Views

Activity

Xcode 15.1 is adding extra lines in between print() statements, sometimes
Yesterday, my code ran just fine under the previous Xcode version. Today, some print() statements seem to come with extra lines. I know it sounds stupid, but my code did not change in the meantime. It doesn't appear to come from anything I control, almost like some Apple code emits an extra line feed somewhere. It's just a Swift Mac App I built to make my digital art; otherwise, nothing else is incorrect, just these odd lines. It's not as simple as just making a test case with a few print("***") statements, it seems to require other code to run in between calls to print. Most of my app is using CoreGraphics. It has no UI. It's like when you see spurious Apple debugging info in the console sometimes, but it's only a blank line this time. It's not a big issue, just annoying.
4
1
1.3k
Dec ’23
M1Utra vs Old iMac, why is retain/release on M1 42 times slower?
I have a swift project that operates on pixels (image generation) in parallel. Running the exact same code with the same settings (81M pixels) on my 2017 iMac and my M1Ultra (release builds, MacOS). The M1 Ultra takes nearly 2 min and the iMac takes 10.3 seconds. The main difference in profiler is calls to retain/release totaling 84 seconds on M1Ultra and 2 seconds on iMac i7. Like, how is this even possible? It makes this $4K Mac Studio a boat anchor as far as my need for it. Despite having 20 threads running vs 8, the MS is horrifically slow solely due to the retain/release molasses. This is not a user app but a command line app. Instruments seems hopeless to tell me exactly what is even calling retain/release. I can see its ARM vs Intel code generation and otherwise the rest of the code seems equivalent. If someone from Apple would comment I'd be willing to burn a support ticket (I used to work at DTS long ago). Otherwise I will post it to Medium to see if anyone can explain this. This is the whole reason I spent so much on the MS, now it seems a waste of $.
3
0
1.1k
Mar ’22
Animation for DisclosureGroup open/close
A disclosure group in a list animates the open close when you tap on the > icon. I need to support tapping on the entire title label. This code works below, but the tapGesture on the label does not do any animation like the > button does. Is there some way to have DisclosureGroup use the same animation as it does itself? 		@State var guestsExpanded: Bool = true 		 		var body: some View 		{ 				List() 				{ 						DisclosureGroup(isExpanded: $guestsExpanded, content: 						{ 								ForEach( model.guests ) { guest in GuestView(guest: guest, selectedGuests: $selectedGuests) } 						}, label: {	Text("Guests").onTapGesture { guestsExpanded = !guestsExpanded } }) 						... 				} 		}
6
0
4.0k
Jul ’20
Binding a List to one of two @Published arrays
I have an environment object with two arrays of the same type, each array is @Published In a View I want to show a list of one or the other array in a List, which array is chosen is set on showing the View How do I tell the View which array to show?@EnvironmentObject var model: Model 		var body: some View 		{ 				List 				{ 						ForEach(model.a.indices) 						{ index in 								ThingView( rowData: self.$model.a[index] ) 						} 				} 		} Model contains: 		@Published var a: [String] 		@Published var b: [String] I want to pick "a" or "b" when the view is shown, do I use @State or a @Binding or what?
4
0
905
Jul ’20
@Environment example out of Apple's own SwiftUI comments fails to compile
This exact code appears in apple's comment in the SwiftUI module, but when I use it, it fails to compile with errors: Enum 'Environment' cannot be used as an attribute Type annotation missing in pattern So is apple wrong about their own code or did we get an Xcode version that does not support this construct? I tried @EnvironmentObject as well and it get different errors. @main struct MyApp: App { @Environment(\.scenePhase) private var scenePhase var body: some Scene { ...
4
1
2.5k
Jul ’20