Post

Replies

Boosts

Views

Activity

Reply to Can't extract Xcode_12.5.1.xip file
Would external drive be an issue (I have Xcode_12.5.1.xip on external drive)? In my environment, I have succeeded to expand Xcode_12.5.1.xip on an external storage recently. It took about 2 hours or more, and the extracted Xcode.app shows as 32.88 GB. But working fine after I renamed it to Xcode12.5.1.app and moved to /Applications folder. Do you have enough disk space? Internet connection is stable enough in your environment?
Nov ’21
Reply to SF Symbols Fill
Have you checked the WWDC 21 session videos about SF Symbols? What’s new in SF Symbols SF Symbols in SwiftUI New this year, tab bars and other views now automatically opt into specific variants, like fill, to be applied to any symbols they contain.  So, when you specify the base name book, the runtime of SwiftUI 3 chooses the variant fill automatically. You may need to write something like this to disable the default variant: ProductsListView() .tabItem { Image(systemName: "book") .environment(\.symbolVariants, .none) //<- Text("Products") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to UserDefaults and arrays
In the first line of addItem(completedTask:), the local variable array is declared and initialized to an empty array ([]). Whether or not UserDefaults has some value, it is initialized as an empty array. So, when you call userDefaults.set(array, forKey: "userDefault-completedItems"), array contains only one item: completedTask. I guess you may want to do something like this: private let kUserDefaultsCompletedItems = "userDefault-completedItems" func addItem(completedTask: Int){ let userDefaults = UserDefaults.standard var array: [Int] = userDefaults.array(forKey: kUserDefaultsCompletedItems) as? [Int] ?? [] array.append(completedTask) // Setting userDefaults userDefaults.set(array, forKey: kUserDefaultsCompletedItems) // Read userDefaults let userDefaultArray = userDefaults.array(forKey: kUserDefaultsCompletedItems) as? [Int] ?? [] print("added items read from userdefaults \(userDefaultArray)") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to Xcode 13.1 "There is not enough disk space available to install the product."
I have 43.57 GB of storage available which I think should be enough to install Xcode Unfortunately, it is not enough. given that on the App Store the size is 12.4 GB You may send a bug report to Apple that the current App Store shows too small required disk space, but that does not fix your issue. You can try downloading Xcode.xip from the Downloads page of the developer site, it consumes about 13 GB. And the expanded Xcode.app about 33 GB. So, you may need 46 GB or more while expanding. Remove unused things from your start up disk and try again. Or if you have an external storage of enough free space, download Xcode.xip into it and expand it there. In this case, I recommend you to move Xcode.app to the start up disk before running it.
Nov ’21
Reply to I'm having trouble refactoring a function call
If that's not correct, let me know. Not correct. Instantiating means creating a new instance of some specific type. The code var publishedClassContact: PublishedClassContact declares that the type of publishedClassContact is PublishedClassContact, but it does not create an instance of PublishedClassContact. For example, in this line @StateObject var vm = funcTest(), you create an instance of funcTest with using the initializer init(). (By the way, in Swift, type names should start with Capital letters, you should better follow the basic coding rule of Swift, even if you are writing a simplified example.) Please let me know if this needs clarification. You repeat refactor but not clear about to achieve what.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to Why the first item I tap on a SwiftUI List becomes nil when present it in a sheet
Unfortunately, there's a known issue when you want to use @State variables inside a closure passed to .sheet. (Seems Apple does not think this issue as a thing to be fixed.) One possible workaround is declaring another view and pass the binding to it: struct UpdateStateProperty: View { var items:[Item] = [Item(name: "Oranges"), Item(name: "Apples"), Item(name: "Cookies") ] @State private var presentView = false @State private var selectedItem: Item? var body: some View { List{ ForEach(items){ item in HStack{ Text(item.name) }.onTapGesture { selectedItem = item presentView.toggle() } } } .sheet(isPresented: $presentView){ MySheetView(selectedItem: $selectedItem) } } } struct MySheetView: View { @Binding var selectedItem: Item? var body: some View { Text("\(selectedItem?.name ?? "*nil*")") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to I'm having trouble refactoring a function call
I have a class file for instantiating PublishedClassAccount.  Please show the code instantiating PublishedClassAccount. here's my code for PublishedClassAccount Thanks for showing the definition of PublishedClassAccount, but I want to see the code where it instantiates PublishedClassAccount. I'm lost as to how I would create an object in the @Environment call anyway. I do not understand what you want to achieve, but there is one thing clear: You cannot use @Environment in a non-View context. If you want to define a class, you cannot use @Environment in the class. If you want to use @Environment, you cannot use class.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to Code axie infinity
The dev forums is not a place to request an invitation code of some specific app. Contact to the author of the app.
Nov ’21