Post

Replies

Boosts

Views

Activity

View previous commit
I'm missing something. I have a project in Xcode 16.2. I have made two commits. I did not tag the commits. I need to compare what is in the first commit to the current state of a file. The instructions say that when comparing files there is a button at the bottom to select the commit to compare with, but I can't find that button. It looks like I can only compare the current state of the file with the last commit.
1
0
107
5d
Swift Test Parameterized Test
Is anyone seeing flaky results when using parameterized test with pairs of (input, result) data? I have several (5) tests for a given method. I create a zip sequence by zip([in1, in2, in3, in4, in5],[out1, out2, out3, out4, out5]) Sometimes, the test only runs 4 of the tests and fails to report a failure even though I deliberately place data that should cause a failure. Sometimes, even though I only select one test to run, the test explorer goes crazy into a loop and I have to clear test results to get it to stop. Following a suggestion, I disabled running tests in parallel. Xcode 16.2 / OSX 14.7 (Sonoma) / Mac mini M2 Pro
3
0
165
1w
SwiftTesting
I am using Swift Testing for TDD my project. I have a struct that contains an array of 65536 UInt8's along with other properties. I am testing methods that modify the properties of the struct including the contents of the array. In just one of my test files, any test fails (there are several in the file), the entire contents of the struct, including the array, are printed to the console. In another test file they are not. I'm don't think there are any differences to the test setup in the two files. Any idea what's going on? I'm able get the program to skip the dump to the console by copying the properties I want to test to local let constants and testing those. Thanks
1
0
156
1w
SwiftData One To Many
I'm working through the Develop In Swift tutorial at page [https://developer.apple.com/tutorials/develop-in-swift/navigation-editing-and-relationships-conclusion)] The tutorial has a one to many relationship between Friend and Movie (each friend can have at most one favorite movie and each movie can be the favorite for zero or more friends). An exercise left to the student is to use an .onDelete on the movie detail page to delete that movie as favorite. I modified the Form Form { TextField("Movie title", text: $movie.title) DatePicker("Release date", selection: $movie.releaseDate, displayedComponents: .date) if !movie.favoritedBy.isEmpty { Section("Favorited by") { ForEach(sortedFriends) { friend in Text(friend.name) } .onDelete(perform: deleteFavorites(indexes:)) } } } by adding the .onDelete clause I added private func deleteFavorites(indexes: IndexSet) { for index in indexes { context.delete(movie.favoritedBy[index]) } } to the view. This does delete the favorite movie, but it also deletes the friend. My assumption is that the selected friend should then have no favorite movie rather than being deleted There is an if in the Form that doesn't display the FAVORITED BY section if no friend has that movie as a favorite, but if I delete all the friends who had this movie as a favorite, the section remains (but is empty), until I exit the MovieDetail view and reload it There is no answer for these exercises, so I could be doing it wrong. EDIT: If I delete a movie using the app function to delete a movie, friends that have that movie as a favorite are not deleted and have their favorite movie set to None
3
0
369
1w
LinearGradient not completely filling shape
I am working through an Apple Developer SwiftUI Landmarks Tutorial using Xcode 16.2 on a M2 Pro Mac mini with OSX 14.7 (Sonoma). Under Drawing paths and Shapes, the step where they draw the background, the linearGradient is not filling the top and bottom of the hex shape. If I use a solid fill the shape is filled. I've attached a screenshot from the tutorial showing the entire shape filled with the linear gradient, a screen shot from Xcode showing the gradient not filling the top and bottom of the shape and a screen shot from Xcode showing that a solid fill does work. I found one online mention that implies that this started when the author upgraded to Xcode 16. Since the tutorial was written for Xcode 15, I assume that it worked there.
4
0
227
2w
Save Data from Swift Playgrounds App (Mac)
How do you save data from a Swift Playgrounds App on the Mac? I get an error 'playgroundSharedDataDirectory is not supported in Swift Playgrounds' I think it's doable, some of the Swift Playgrounds tutorials remember the pages I've completed. This is with Playgrounds 4.5.1 on a Mac mini M2 Pro running OSX 14.7 (Sonoma) Ideally, I'd like to save multiple 'documents' and allow the user to select which one they want to work with. The documents don't need to be visible to other Apps. Thanks in advance
0
0
238
3w
Create Mac App from Swift Playgrounds
I am running Swift Playgrounds 4.51 under OSX 14.7 on a Mac mini M2 Pro. Under App settings for my app, I select "Install on this Mac." I get an error "An error occurred during installation Please check Console.app for further information" I can't find any entry in the console logs for this. I have a personal (free) developer account. Is there a way to create a Finder launchable app with Swift Playgrounds? I found part of the problem. My main user that I use for "normal" activity does not have administrative rights. If I give that user administrative rights, the create app succeeds and the app is added to the global Applications folder. Is there a way to have the app added to my User Application folder that then shouldn't require administrative access?
2
0
242
Jan ’25
How to align text?
I'm trying to create a custom control similar to a DisclosureGroup. I would like to align the leading edges of "11" and "First". There is a Button preceding "First", but none preceding "11". Bonus question. I'm using SF Symbols for the arrows, but I would like to use the > and V used in DisclosureGroup. Are those symbols available? Thanks, Mark var body: some View { List(items, selection: $selection) { master in HStack { if master.master { Button { if master.master { expanded.formSymmetricDifference([master.id]) } } label: { Image(systemName: expanded.contains(master.id) ? "arrowtriangle.down" : "arrowtriangle.forward") } .buttonStyle(BorderlessButtonStyle()) } Text(master.name) } } .frame(width: 200) }
0
0
687
Jun ’22
Why did Preview stop working?
This morning the Canvas preview on the app I am developing starting displaying "Cannot preview in this file...". The diagnostics display complains: MessageSendFailure: Message send failure for send previewInstances message to agent ================================== |  RemoteHumanReadableError |   |  LoadingError: failed to load library at path "/Users/mark/Library/Containers/com.microenh.BoxDesigner/Data/MainView.1.preview-thunk.dylib": Optional(dlopen(/Users/mark/Library/Containers/com.microenh.BoxDesigner/Data/MainView.1.preview-thunk.dylib, 0x0002): tried: '/Users/mark/Library/Developer/Xcode/DerivedData/BoxDesigner-gbhzycedtosmdoetkpwtcpuwawhb/Build/Intermediates.noindex/Previews/BoxDesigner/Products/Debug/MainView.1.preview-thunk.dylib' (no such file), '/Users/mark/Library/Containers/com.microenh.BoxDesigner/Data/MainView.1.preview-thunk.dylib' (code signature in <D4EED909-712E-3055-B429-BBA7EB77A196> '/Users/mark/Library/Containers/com.microenh.BoxDesigner/Data/MainView.1.preview-thunk.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?))) The file /Users/mark/Library/Containers/com.microenh.BoxDesigner/Data/MainView.1.preview-thunk.dylib is present. I tried deleting the /Users/mark/Library/Containers/com.microenh.BoxDesigner folder and rebuilding. No change.
0
0
705
May ’22
Does Xcode still support dual monitors?
I have a Mac Mini M1 with OSX Monterey. I just upgraded to 12.4. I'm currently using Xcode 13.4, but I've had this problem for a while now. I have two Acer CB282K monitors. CB282K(2) is connected to the Mini's HDMI port and is configured as the main display. CB282K(1) is connected to a USB-C port via a USB-C / HDMI adapter and is configured as extended. Both monitors appear to be working perfectly. If I hover my mouse over the green button at the top of the most windows, one of the pop up options is "move to CB282K(1)" or "move to CB282K(2)" depending on which monitor is currently displaying the window. This works fine with most if not all of my programs (including Mail and Safari), but not with Xcode. When I first open any window, while the option is there, selecting it does not move the window to the other monitor. However, if I drag the window to the other window, the option works to move the window back and forth between the monitors. If I close the window and re-open it, it is again "locked" to the main display until I drag it. I see this behavior with the first Xcode window I open, with a second Xcode window I open (say I want to view two projects at the same time), or with the Developer Help window. I'm pretty sure that when I started with Xcode last summer, this feature worked, but it has stopped at some point in the past.
1
0
1.2k
May ’22