Post

Replies

Boosts

Views

Activity

Foundation Models are broken in iOS 27 Beta
Hi guys, I'm testing the Foundation Models Framework with the on-device model in iOS 27 (beta 4) and macOS 27 (beta 4) and is completely failing to respond. There are many errors. For starters, the model doesn't respond to prompts directly, you need to specify instructions, otherwise it refuses to provide an answer. It is always looking for tools, even when no tool has been provided, and returns an error saying that it couldn't find the tool. Then, when it produces a response, it shows all the thinking process first, which completely ruins the response. Most of the time, the response begins with all the JSON code. And when I try to have a long conversation, it just says "I cannot write content or generate text." I wonder if someone is experiencing the same issues or maybe the way to implement this model changed and I'm missing something? Here is a screenshot of one of my interactions when I asked the model to describe a unicorn. It tried to access a tool that doesn't exist. (the app just prints the value of the content property) Here is the code. It is performing a simple request. struct ContentView: View { @State private var response = "" var body: some View { VStack { Button("Send") { let prompt = "Write a paragraph describing a unicorn" let session = LanguageModelSession { "Respond to the user's request. Never acknowledge the request, add preamble, or comment on what you are about to write." } if !session.isResponding { Task { do { let answer = try await session.respond(to: prompt) response = answer.content } catch { response = "Error accessing the model: \(error)" } } } } .buttonStyle(.borderedProminent) Text(response) .font(Font.system(size: 18)) .padding() Spacer() } .padding() } }
4
0
101
1d
Xcode 27 Agent is impossible to work with.
Working with Agents in Xcode 27 is a nightmare right now. Every conversation opens in a new window, so you don't see the code you and the agent are working on. You have to go back and forward between the code file and the conversation tab to get the names of data types or functions you need to ask the agent to work on, or to see exactly what you need to ask or how to explain it to the agent. We need the conversation and the code to be side by side to be able to work on the code and provide the right instructions, as we do in Xcode 26. The current interface just completely ruins any reasonable workflow, unless you are vibe coding, which I don't recommend. Let me know if there is a way to open the conversation on one side and code files on the other, or PLEASE change it back of what it was before or I will have to keep working on Xcode 26 and miss all the new features. Thanks
7
2
495
Jul ’26
Xcode 27 How do we declare the accent color?
Hi guys In Xcode 27, we have to create the Assets Catalog file ourselves. This file is empty. The icon now is generated by Icon Composer, but how do you specify the accent color? I tried creating a Color set with the name AccentColor but didn't work. And look for options in the project settings but couldn't find any.
1
0
139
Jul ’26
Xcode 27 How to specify the bundle Identifier
Xcode 27 creates a placeholder for the bundle identifier of a new project. devplaceholder.$(PROJECT_UNIQUE_VALUE:identifier).$(PRODUCT_NAME:identifier) I have two questions. Is it enough to change the bundle id from the Signing & Capabilities panel or do we need to change it somewhere else? What are Apple recommendations? Should we only replace the devplaceholder value and keep the unique value and product name, provide our won id but keep the product name, or replace everything with our own bundle ID? Thanks
2
0
237
Jul ’26
Bug in the Agentic Coding chat box
Since a few days ago, I noticed that every time you go to the top of the text in the Agentic Coding chat box, if you keep pressing the up arrow, the current message is replaced by the previous one. It's like someone decided to allow users to use the arrows to navigate to previous conversations in the same context, but this means that you are constantly jumping to previous messages by accident. The "feature" is error prone, confusing, and extremely annoying. If someone knows of an option in setting to disable it, please let me know. I'm constantly making mistakes, wasting tokens, editing the wrong message, and making the conversation confusing by sending the wrong message to the agent.
0
0
89
May ’26
Agentic coding issues
Hi guys, Two annoying issues I'm having at the moment with agentic coding. Xcode signs out of Claude every single day and gives the error Failed to authenticate. API Error: 401. The only solution is go to settings and sign out of Claude and in again. Apple removed the little arrow to select the model, so now every time you start a new conversation you have to pick the model. I just want to start a new conversation with the model I'm using. The extra click is a time waster. Any solutions would be appreciated. Thanks
1
0
244
Apr ’26
Do App Intent Domains work with Siri already?
Hi, guys. I'm writing about Apple Intelligence and I reached the point I have to explain App Intent Domains https://developer.apple.com/documentation/AppIntents/app-intent-domains but I noticed that there is a note explaining that these services are not available with Siri. I tried the example provided by Apple at https://developer.apple.com/documentation/AppIntents/making-your-app-s-functionality-available-to-siri and I can only make the intents work from the Shortcuts App, but not from Siri. Is this correct. App Intent Domains are still not available with Siri? Thanks
0
0
549
Nov ’25
SwiftData serious bug with relationships and CloudKit in iOS 18.0 (Xcode 16 Beta)
Hi guys. Can someone please confirm this bug so I report it? The issue is that SwiftData relationships don't update the views in some specific situations on devices running iOS 18 Beta. One clear example is with CloudKit. I created a small example for testing. The following code creates two @models, one to store bands and another to store their records. The following code works with no issues. (You need to connect to a CloudKit container and test it on two devices) import SwiftUI import SwiftData struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query private var records: [Record] var body: some View { NavigationStack { List(records) { record in VStack(alignment: .leading) { Text(record.title) Text(record.band?.name ?? "Undefined") } } .toolbar { ToolbarItem { Button("Add Record") { let randomNumber = Int.random(in: 1...100) let newBand = Band(name: "New Band \(randomNumber)", records: nil) modelContext.insert(newBand) let newRecord = Record(title: "New Record \(randomNumber)", band: newBand) modelContext.insert(newRecord) } } } } } } @Model final class Record { var title: String = "" var band: Band? init(title: String, band: Band?) { self.title = title self.band = band } } @Model final class Band { var name: String = "" var records: [Record]? init(name: String, records: [Record]?) { self.name = name self.records = records } } This view includes a button at the top to add a new record associated with a new band. The data appears on both devices, but if you include more views inside the List, the views on the second device are not updated to show the values of the relationships. For example, if you extract the row to a separate view, the second device shows the relationships as "Undefined". You can try the following code. struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query private var records: [Record] var body: some View { NavigationStack { List { ForEach(records) { record in RecordRow(record: record) } } .toolbar { ToolbarItem { Button("Add Record") { let randomNumber = Int.random(in: 1...100) let newBand = Band(name: "New Band \(randomNumber)", records: nil) modelContext.insert(newBand) let newRecord = Record(title: "New Record \(randomNumber)", band: newBand) modelContext.insert(newRecord) } } } } } } struct RecordRow: View { let record: Record var body: some View { VStack(alignment: .leading) { Text(record.title) Text(record.band?.name ?? "Undefined") } } } Here I use a ForEach loop and move the row to a separate view. Now on the second device the relationships are nil, so the row shows the text "Undefined" instead of the name of the band. I attached an image from my iPad. I inserted all the information on my iPhone. The first three rows were inserted with the first view. But the last two rows were inserted after I extracted the rows to a separate view. Here you can see that the relationships are nil and therefore shown as "Undefined". The views are not updated to show the real value of the relationship. This example shows the issue with CloudKit, but this also happens locally in some situations. The system doesn't detect updates in relationships and therefore doesn't refresh the views. Please, let me know if you can reproduce the issue. I'm using Mac Sequoia 15.1, and two devices with iOS 18.0.
3
0
993
Apr ’25
Binding with ForEach or List doesn't work anymore when using @Observable macro
Hi. The binding in a ForEach or List view doesn't work anymore when using the @Observable macro to create the observable object. For example, the following are the modifications I introduced to the Apple's example called "Migrating from the Observable Object Protocol to the Observable Macro" https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro struct LibraryView: View { @Environment(Library.self) private var library var body: some View { List($library.books) { $book in BookView(book: book) } } } All I did was to add the $ to turn the reference to library.books into a binding but I got the error "Cannot find '$library' in scope" Is this a bug or the procedure to use binding in lists changed? Thanks
3
0
2.4k
Oct ’24
Updating a Core Data object does not update the SwiftUI view
Hi, guys. When I update a value in a Core Data object, the view is not updated to show the change. I don't understand what I'm doing wrong, since this worked before. Right now I have Xcode 16 Beta installed, but it happens with Xcode 15. Here is an example. import SwiftUI import CoreData struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @State private var selectedItem: Item? var body: some View { NavigationStack { VStack { Text("Year: \(selectedItem?.year ?? 0)") .onTapGesture { changeYear() } Spacer() } .onAppear { // Load an item from the database let request: NSFetchRequest<Item> = Item.fetchRequest() request.fetchLimit = 1 if let item = try? viewContext.fetch(request).first { selectedItem = item } } } } private func changeYear() { let year = Int16.random(in: 1900..<2020) print("Random year: \(year)") selectedItem?.year = year try? viewContext.save() } } #Preview { ContentView() .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } I think it is easy to follow. There is an entity called Item with an attribute called year. I preloaded a few objects for the preview. This view loads one item and assigns it to a state property. When you tap on the Text view, the changeYear() method is executed. In this method I select a random year, assign it to the object in the selectedItem property and save the context. A message is printed on the console with the new value, but the view never updates. I'm also having similar problems with SwiftData and To Many relationships. They also do not update the views when they are modified. In case you want to test it, you can just create a new project with Core Data set in, change the name of the attribute in the Item entity to year and select Int16 as the data type, and then update the following method to preload some values. @MainActor static let preview: PersistenceController = { let result = PersistenceController(inMemory: true) let viewContext = result.container.viewContext for _ in 0..<10 { let newItem = Item(context: viewContext) newItem.year = Int16.random(in: 1900..<2020) } do { try viewContext.save() } catch { let nsError = error as NSError fatalError("Unresolved error \(nsError), \(nsError.userInfo)") } return result }() Thanks for any help.
2
1
1.7k
Aug ’24
How the new relationships in SwiftData work?
There is a new Relationship macro in Xcode Beta 6. The macro includes two new arguments: minimumModelCount and maximumModelCount. I wonder if anyone knows what these values are for and if there is another change under the hood. Relationship( _ options: PropertyOptions..., deleteRule: Schema.Relationship.DeleteRule = .nullify, minimumModelCount: Int? = 0, maximumModelCount: Int? = 0, originalName: String? = nil, inverse: AnyKeyPath? = nil, hashModifier: String? = nil )
1
1
873
Aug ’23
SwiftUI PhotosPicker deselection doesn't work
Hi, guys. In Xcode Beta 4, the PhotosPicker view doesn't modify the state property when all the items are deselected. This seems to be a bug, but I don't know how to file a bug for a beta API. This code generates a list with the selected pictures. If you select a picture and then deselect it, the item is not removed from the list. import SwiftUI import PhotosUI struct ContentView: View {    @State private var selected: [PhotosPickerItem] = []    var body: some View {       NavigationStack {          List(selected, id: \.itemIdentifier) { item in             Text(item.itemIdentifier ?? "")          }          .toolbar {             ToolbarItem(placement: .navigationBarTrailing) {                PhotosPicker(selection: $selected, matching: .images, photoLibrary: .shared()) { Text("Select Photos") }             }          }       }    } }
1
0
1.7k
Aug ’23
Xcode bug in SwiftUI previews when using Core Data
Hi, guys. Can someone confirm this problem so I submit the bug to Apple. When the Core Data Persistent Store is empty, the canvas preview crashes. To test it, you just need to create a new project with the Core Data option enabled. Then go to the Persistence.swift file created by the template, and remove the for in loop in the closure assigned to the preview property that creates 10 new items. The property will look like this: static var preview: PersistenceController = { let result = PersistenceController(inMemory: true)    return result }() Now, you will get an error when the system tries to fetch items [NSManagedObjectContext executeFetchRequest:error:]. You only need to add one single item for the error to disappear. It looks like a pretty bad bug, so I want to be sure it is not my computer. Thanks.
3
0
1.8k
Jan ’22
Pop Up buttons in Interface Builder don't show menu in iOS 15
Hi, guys. I'm testing the new pop-up and pull-down buttons in iOS 15, but they do not show the pop-up menu when pressed (all the options in the Attributes Inspector panel are checked). They only work when I define the entire menu in code. My questions are: Is this because the feature was not implemented yet? If this is implemented later and we can define the menu in Interface Builder, how do you respond to a selection? In code, I can specify the action in the closure, but how do I do it if the menu is defined in Interface Builder? This is how I define the menu from code, just in case someone needs to know: import UIKit class ViewController: UIViewController {   @IBOutlet weak var myButton: UIButton!   override func viewDidLoad() {    super.viewDidLoad()         let optionsClosure = { (action: UIAction) in      print(action.title)    }    myButton.menu = UIMenu(children: [      UIAction(title: "Option 1", state: .on, handler: optionsClosure),      UIAction(title: "Option 2", handler: optionsClosure),      UIAction(title: "Option 3", handler: optionsClosure)    ])   } } Thanks JD
3
0
5.2k
Nov ’21
Foundation Models are broken in iOS 27 Beta
Hi guys, I'm testing the Foundation Models Framework with the on-device model in iOS 27 (beta 4) and macOS 27 (beta 4) and is completely failing to respond. There are many errors. For starters, the model doesn't respond to prompts directly, you need to specify instructions, otherwise it refuses to provide an answer. It is always looking for tools, even when no tool has been provided, and returns an error saying that it couldn't find the tool. Then, when it produces a response, it shows all the thinking process first, which completely ruins the response. Most of the time, the response begins with all the JSON code. And when I try to have a long conversation, it just says "I cannot write content or generate text." I wonder if someone is experiencing the same issues or maybe the way to implement this model changed and I'm missing something? Here is a screenshot of one of my interactions when I asked the model to describe a unicorn. It tried to access a tool that doesn't exist. (the app just prints the value of the content property) Here is the code. It is performing a simple request. struct ContentView: View { @State private var response = "" var body: some View { VStack { Button("Send") { let prompt = "Write a paragraph describing a unicorn" let session = LanguageModelSession { "Respond to the user's request. Never acknowledge the request, add preamble, or comment on what you are about to write." } if !session.isResponding { Task { do { let answer = try await session.respond(to: prompt) response = answer.content } catch { response = "Error accessing the model: \(error)" } } } } .buttonStyle(.borderedProminent) Text(response) .font(Font.system(size: 18)) .padding() Spacer() } .padding() } }
Replies
4
Boosts
0
Views
101
Activity
1d
Xcode 27 Agent is impossible to work with.
Working with Agents in Xcode 27 is a nightmare right now. Every conversation opens in a new window, so you don't see the code you and the agent are working on. You have to go back and forward between the code file and the conversation tab to get the names of data types or functions you need to ask the agent to work on, or to see exactly what you need to ask or how to explain it to the agent. We need the conversation and the code to be side by side to be able to work on the code and provide the right instructions, as we do in Xcode 26. The current interface just completely ruins any reasonable workflow, unless you are vibe coding, which I don't recommend. Let me know if there is a way to open the conversation on one side and code files on the other, or PLEASE change it back of what it was before or I will have to keep working on Xcode 26 and miss all the new features. Thanks
Replies
7
Boosts
2
Views
495
Activity
Jul ’26
Xcode 27 How do we declare the accent color?
Hi guys In Xcode 27, we have to create the Assets Catalog file ourselves. This file is empty. The icon now is generated by Icon Composer, but how do you specify the accent color? I tried creating a Color set with the name AccentColor but didn't work. And look for options in the project settings but couldn't find any.
Replies
1
Boosts
0
Views
139
Activity
Jul ’26
Xcode 27 How to specify the bundle Identifier
Xcode 27 creates a placeholder for the bundle identifier of a new project. devplaceholder.$(PROJECT_UNIQUE_VALUE:identifier).$(PRODUCT_NAME:identifier) I have two questions. Is it enough to change the bundle id from the Signing & Capabilities panel or do we need to change it somewhere else? What are Apple recommendations? Should we only replace the devplaceholder value and keep the unique value and product name, provide our won id but keep the product name, or replace everything with our own bundle ID? Thanks
Replies
2
Boosts
0
Views
237
Activity
Jul ’26
Bug in the Agentic Coding chat box
Since a few days ago, I noticed that every time you go to the top of the text in the Agentic Coding chat box, if you keep pressing the up arrow, the current message is replaced by the previous one. It's like someone decided to allow users to use the arrows to navigate to previous conversations in the same context, but this means that you are constantly jumping to previous messages by accident. The "feature" is error prone, confusing, and extremely annoying. If someone knows of an option in setting to disable it, please let me know. I'm constantly making mistakes, wasting tokens, editing the wrong message, and making the conversation confusing by sending the wrong message to the agent.
Replies
0
Boosts
0
Views
89
Activity
May ’26
Agentic coding issues
Hi guys, Two annoying issues I'm having at the moment with agentic coding. Xcode signs out of Claude every single day and gives the error Failed to authenticate. API Error: 401. The only solution is go to settings and sign out of Claude and in again. Apple removed the little arrow to select the model, so now every time you start a new conversation you have to pick the model. I just want to start a new conversation with the model I'm using. The extra click is a time waster. Any solutions would be appreciated. Thanks
Replies
1
Boosts
0
Views
244
Activity
Apr ’26
Do App Intent Domains work with Siri already?
Hi, guys. I'm writing about Apple Intelligence and I reached the point I have to explain App Intent Domains https://developer.apple.com/documentation/AppIntents/app-intent-domains but I noticed that there is a note explaining that these services are not available with Siri. I tried the example provided by Apple at https://developer.apple.com/documentation/AppIntents/making-your-app-s-functionality-available-to-siri and I can only make the intents work from the Shortcuts App, but not from Siri. Is this correct. App Intent Domains are still not available with Siri? Thanks
Replies
0
Boosts
0
Views
549
Activity
Nov ’25
SwiftData serious bug with relationships and CloudKit in iOS 18.0 (Xcode 16 Beta)
Hi guys. Can someone please confirm this bug so I report it? The issue is that SwiftData relationships don't update the views in some specific situations on devices running iOS 18 Beta. One clear example is with CloudKit. I created a small example for testing. The following code creates two @models, one to store bands and another to store their records. The following code works with no issues. (You need to connect to a CloudKit container and test it on two devices) import SwiftUI import SwiftData struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query private var records: [Record] var body: some View { NavigationStack { List(records) { record in VStack(alignment: .leading) { Text(record.title) Text(record.band?.name ?? "Undefined") } } .toolbar { ToolbarItem { Button("Add Record") { let randomNumber = Int.random(in: 1...100) let newBand = Band(name: "New Band \(randomNumber)", records: nil) modelContext.insert(newBand) let newRecord = Record(title: "New Record \(randomNumber)", band: newBand) modelContext.insert(newRecord) } } } } } } @Model final class Record { var title: String = "" var band: Band? init(title: String, band: Band?) { self.title = title self.band = band } } @Model final class Band { var name: String = "" var records: [Record]? init(name: String, records: [Record]?) { self.name = name self.records = records } } This view includes a button at the top to add a new record associated with a new band. The data appears on both devices, but if you include more views inside the List, the views on the second device are not updated to show the values of the relationships. For example, if you extract the row to a separate view, the second device shows the relationships as "Undefined". You can try the following code. struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query private var records: [Record] var body: some View { NavigationStack { List { ForEach(records) { record in RecordRow(record: record) } } .toolbar { ToolbarItem { Button("Add Record") { let randomNumber = Int.random(in: 1...100) let newBand = Band(name: "New Band \(randomNumber)", records: nil) modelContext.insert(newBand) let newRecord = Record(title: "New Record \(randomNumber)", band: newBand) modelContext.insert(newRecord) } } } } } } struct RecordRow: View { let record: Record var body: some View { VStack(alignment: .leading) { Text(record.title) Text(record.band?.name ?? "Undefined") } } } Here I use a ForEach loop and move the row to a separate view. Now on the second device the relationships are nil, so the row shows the text "Undefined" instead of the name of the band. I attached an image from my iPad. I inserted all the information on my iPhone. The first three rows were inserted with the first view. But the last two rows were inserted after I extracted the rows to a separate view. Here you can see that the relationships are nil and therefore shown as "Undefined". The views are not updated to show the real value of the relationship. This example shows the issue with CloudKit, but this also happens locally in some situations. The system doesn't detect updates in relationships and therefore doesn't refresh the views. Please, let me know if you can reproduce the issue. I'm using Mac Sequoia 15.1, and two devices with iOS 18.0.
Replies
3
Boosts
0
Views
993
Activity
Apr ’25
Binding with ForEach or List doesn't work anymore when using @Observable macro
Hi. The binding in a ForEach or List view doesn't work anymore when using the @Observable macro to create the observable object. For example, the following are the modifications I introduced to the Apple's example called "Migrating from the Observable Object Protocol to the Observable Macro" https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro struct LibraryView: View { @Environment(Library.self) private var library var body: some View { List($library.books) { $book in BookView(book: book) } } } All I did was to add the $ to turn the reference to library.books into a binding but I got the error "Cannot find '$library' in scope" Is this a bug or the procedure to use binding in lists changed? Thanks
Replies
3
Boosts
0
Views
2.4k
Activity
Oct ’24
iOS Beta 18.1 does not install on old devices
Hi, guys. I installed iOS Beta 18.0 on my iPhone SE and iPad 9th, but the system does not upgrade to 18.1. These devices can't run Apple Intelligence. Is it that the reason? And if so, does anyone know how Apple is going to manage this situation? Thanks
Replies
2
Boosts
0
Views
1.3k
Activity
Sep ’24
Updating a Core Data object does not update the SwiftUI view
Hi, guys. When I update a value in a Core Data object, the view is not updated to show the change. I don't understand what I'm doing wrong, since this worked before. Right now I have Xcode 16 Beta installed, but it happens with Xcode 15. Here is an example. import SwiftUI import CoreData struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @State private var selectedItem: Item? var body: some View { NavigationStack { VStack { Text("Year: \(selectedItem?.year ?? 0)") .onTapGesture { changeYear() } Spacer() } .onAppear { // Load an item from the database let request: NSFetchRequest<Item> = Item.fetchRequest() request.fetchLimit = 1 if let item = try? viewContext.fetch(request).first { selectedItem = item } } } } private func changeYear() { let year = Int16.random(in: 1900..<2020) print("Random year: \(year)") selectedItem?.year = year try? viewContext.save() } } #Preview { ContentView() .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } I think it is easy to follow. There is an entity called Item with an attribute called year. I preloaded a few objects for the preview. This view loads one item and assigns it to a state property. When you tap on the Text view, the changeYear() method is executed. In this method I select a random year, assign it to the object in the selectedItem property and save the context. A message is printed on the console with the new value, but the view never updates. I'm also having similar problems with SwiftData and To Many relationships. They also do not update the views when they are modified. In case you want to test it, you can just create a new project with Core Data set in, change the name of the attribute in the Item entity to year and select Int16 as the data type, and then update the following method to preload some values. @MainActor static let preview: PersistenceController = { let result = PersistenceController(inMemory: true) let viewContext = result.container.viewContext for _ in 0..<10 { let newItem = Item(context: viewContext) newItem.year = Int16.random(in: 1900..<2020) } do { try viewContext.save() } catch { let nsError = error as NSError fatalError("Unresolved error \(nsError), \(nsError.userInfo)") } return result }() Thanks for any help.
Replies
2
Boosts
1
Views
1.7k
Activity
Aug ’24
How the new relationships in SwiftData work?
There is a new Relationship macro in Xcode Beta 6. The macro includes two new arguments: minimumModelCount and maximumModelCount. I wonder if anyone knows what these values are for and if there is another change under the hood. Relationship( _ options: PropertyOptions..., deleteRule: Schema.Relationship.DeleteRule = .nullify, minimumModelCount: Int? = 0, maximumModelCount: Int? = 0, originalName: String? = nil, inverse: AnyKeyPath? = nil, hashModifier: String? = nil )
Replies
1
Boosts
1
Views
873
Activity
Aug ’23
SwiftUI PhotosPicker deselection doesn't work
Hi, guys. In Xcode Beta 4, the PhotosPicker view doesn't modify the state property when all the items are deselected. This seems to be a bug, but I don't know how to file a bug for a beta API. This code generates a list with the selected pictures. If you select a picture and then deselect it, the item is not removed from the list. import SwiftUI import PhotosUI struct ContentView: View {    @State private var selected: [PhotosPickerItem] = []    var body: some View {       NavigationStack {          List(selected, id: \.itemIdentifier) { item in             Text(item.itemIdentifier ?? "")          }          .toolbar {             ToolbarItem(placement: .navigationBarTrailing) {                PhotosPicker(selection: $selected, matching: .images, photoLibrary: .shared()) { Text("Select Photos") }             }          }       }    } }
Replies
1
Boosts
0
Views
1.7k
Activity
Aug ’23
Xcode bug in SwiftUI previews when using Core Data
Hi, guys. Can someone confirm this problem so I submit the bug to Apple. When the Core Data Persistent Store is empty, the canvas preview crashes. To test it, you just need to create a new project with the Core Data option enabled. Then go to the Persistence.swift file created by the template, and remove the for in loop in the closure assigned to the preview property that creates 10 new items. The property will look like this: static var preview: PersistenceController = { let result = PersistenceController(inMemory: true)    return result }() Now, you will get an error when the system tries to fetch items [NSManagedObjectContext executeFetchRequest:error:]. You only need to add one single item for the error to disappear. It looks like a pretty bad bug, so I want to be sure it is not my computer. Thanks.
Replies
3
Boosts
0
Views
1.8k
Activity
Jan ’22
Pop Up buttons in Interface Builder don't show menu in iOS 15
Hi, guys. I'm testing the new pop-up and pull-down buttons in iOS 15, but they do not show the pop-up menu when pressed (all the options in the Attributes Inspector panel are checked). They only work when I define the entire menu in code. My questions are: Is this because the feature was not implemented yet? If this is implemented later and we can define the menu in Interface Builder, how do you respond to a selection? In code, I can specify the action in the closure, but how do I do it if the menu is defined in Interface Builder? This is how I define the menu from code, just in case someone needs to know: import UIKit class ViewController: UIViewController {   @IBOutlet weak var myButton: UIButton!   override func viewDidLoad() {    super.viewDidLoad()         let optionsClosure = { (action: UIAction) in      print(action.title)    }    myButton.menu = UIMenu(children: [      UIAction(title: "Option 1", state: .on, handler: optionsClosure),      UIAction(title: "Option 2", handler: optionsClosure),      UIAction(title: "Option 3", handler: optionsClosure)    ])   } } Thanks JD
Replies
3
Boosts
0
Views
5.2k
Activity
Nov ’21