Sure, here's the translation:
Hello, I am at a beginner-intermediate level in Swift coding. Lately, I have been trying to improve my skills. When I run the simulator, I get the following error:
"The LLDB RPC server has crashed. You may need to manually terminate your process. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log."
I wrote this feedback, and they responded:
"That looks like you are adding some Python modules to lldb, but have a cycle in the import."
I don’t know how I did this. Whenever I open a new project, I always encounter the same error. Can someone please help?
Diagnostic Text
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello everyone, I have a problem with my Xcode, when I try to add package dependency it stuck on verifying screen, at the beginning of the preparing to validate part.
anyone has the same problem?
Hello, I am trying to build a flashCard app. I am a beginner.
I have 2 structs. One for my cards and one for my deck. and one class that includes both.
struct KnowledgeItem: Identifiable, Codable {
var id = UUID()
let name: String
let knowledge: String
}
struct Deck: Identifiable, Codable {
var id = UUID()
let Deckname: String
let Decksubject: String
}
class Decks: ObservableObject {
@Published var decks = [Deck](){
didSet {
if let encoded1 = try? JSONEncoder().encode(decks) {
UserDefaults.standard.set(encoded1, forKey: "Decks")
}
}
@Published var itemsInDeck = [KnowledgeItem]()
init() {
if let savedDecks = UserDefaults.standard.data(forKey: "Decks") {
if let decodedItemss = try? JSONDecoder().decode([Deck].self, from: savedDecks) {
decks = decodedItemss
return
}
}
decks = []
}
}
I can save my decks. But, I don't know how to save its cards.
Hello, I am a newbie, I am working on 100days of swift. I do not get any errors. I am trying to display words on my list and save them. I am working on a flashcard app. I have 3 files, two of them are views.
My model
import Foundation
import SwiftUI
struct Knowledge: Identifiable,Codable {
var id = UUID()
var term: String
var explanation: String?
var tags: String?
}
class Deck: ObservableObject {
@Published var knowledgeArray = [Knowledge]()
init() {
if let savedItems = UserDefaults.standard.data(forKey: "KnowledgeItems") {
if let decodedItems = try? JSONDecoder().decode([Knowledge].self, from: savedItems) {
knowledgeArray = decodedItems
return
}
}
knowledgeArray = []
}
}
my second view that makes adds terms.
import SwiftUI
import Foundation
struct addCard: View {
@Environment(\.presentationMode) var presentationMode
@Environment(\.dismiss) var dismiss
@State private var terms = ""
@State private var tags = ""
@State private var explanations = ""
@StateObject var KN: Deck
var body: some View {
VStack {
Form {
TextField("Term", text: $terms)
TextField("Explanation", text: $explanations)
TextField("Tag", text: $tags)
}
Button("Save") {
let item = Knowledge(term: terms, explanation: explanations , tags: tags)
KN.knowledgeArray.append(item)
self.presentationMode.wrappedValue.dismiss()
print("Button is working")
}
.padding()
}
}
}
and my final list view
import SwiftUI
struct cardList: View {
@ObservedObject var decks = Deck()
@State private var showingaddCard = false
var body: some View {
NavigationView {
List {
ForEach(decks.knowledgeArray) { cardName in
Text(cardName.term)
.font(.title)
}
.onDelete(perform: removeItems)
}
.toolbar {
Button {
showingaddCard = true
} label: {
Image(systemName: "plus")
}
}
.navigationTitle("Card List")
}
.sheet(isPresented: $showingaddCard) {
addCard(KN: Deck())
}
}
func removeItems(at offsets: IndexSet) {
decks.knowledgeArray.remove(atOffsets: offsets)
}
}
Any advice is appreciated.