Post

Replies

Boosts

Views

Activity

Swift can't find the Entity Core Data
I'm learning Swift and I'm finding some issues to learn it also because my background is as .NET developer and I'm thinking in a different way. So, I'm following a book and I'm trying to add a Core Data to my project. You have the full source code on GitHub. In Xcode a pass a new Entity for Core Data called ToDoCR, very basic. When I try to use the ToDoCR entity, I get some errors from Xcode. Cannot find type 'ToDoCD' in scope override func viewDidLoad() { super.viewDidLoad() } func getToDos() { if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext { if let toDosFromCoreData = try? context.fetch(ToDoCD.fetchRequest()) { if let toDos = toDosFromCoreData as? [ToDoCD] { todoCDs = toDos tableView.reloadData() } } } } Also, when I use the instance of the ToDo Core Data and I perform a boxing, I get another kind of errors. Type of expression is ambiguous without more context Do I have to import a library to access the Core Data? What did I miss in this code?
4
1
4.6k
Aug ’21
Unknown class QuoteDetailViewController in Interface Builder file with Xcode 12
I saw a lot of posts about this error in Xcode but all of them are quite old. I'm learning how to code in Swift and I'm following the instruction of book. My Xcode is version 12.5.1. The goal of this app is to display a list of quotes (string) and when I tap on one of them, display a new view that has as a title the quote. I have a very simple storyboard. There is a TableView with a segue to a View. I created a new Cocoa file for tableview. TableView is working. I connect the TableView with the View. I repeated the some process for the View. I added a new Cocoa file called QuoteDetailViewController, click on top of the view and in the Class I selected from the list the file. When I run the application in the iPhone 11 simulator, the view doesn't have any quote as title. I put a breakpoint in the code connected to the TableView and the app stops there. If I put a breakpoint in the QuoteDetailViewController nothing happens but I see an error in the output 2021-08-11 19:13:17.215204+0100 QuoteApp[80238:4055489] [Storyboard] Unknown class QuoteDetailViewController in Interface Builder file. The QuoteDetailViewController is very basic. The QuoteDetailViewController is very basic. import UIKit class QuoteDetailViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if let quoteViewController = segue.destination as? QuoteDetailViewController { if let selectedQuote = sender as? String { quoteViewController.title = selectedQuote } } } } I tried to build again and again the app. I tried to Clean Build Folder and build again. I tried to recreate the View and the code. After all of that, nothing changed. The error is still there. The source code is on GitHub. Update If I click on the arrow at the end of Class and just before the dropdown, Xcode opens the file I expect to be opened.
1
0
794
Aug ’21
Xcode 12.5.1 can't be installed in macOS Big Sur
I have just received my new iMac :) so happy! The first thing I'm trying to do is to install some developer tools, starting with Xcode. From the App Store, I selected it and started the process. After an hour, the installation was in progress. I tried to restart the machine and restart the process. Xcode is still remaining in this status. I saw some posts where people said to download it from https://developer.apple.com/download/ but the only option I have is to download Xcode 13 beta 3. If I install this version, will I be able to install the release later? Thank you, Enrico
2
0
4.7k
Jul ’21