Post

Replies

Boosts

Views

Activity

Reply to recommended ram memory for xcode14
Coudn't find any minimum system requirements. But as a developer, I always consider that having the max possible amounts of RAM (and the best possible CPU, fastest and largest drive,...) I can afford is the best way. This will also make sure you'll manage with that same machine for longer time without the need to upgrade. Considering that you'd be also running the Simulator at the same time, have a web browser open with dozens of tabs, and a dozen of other apps open at the same time than developing... So you'll need all the RAM you can pay. That is my recommendation.
Apr ’23
Reply to Binary operator '<' cannot be applied to two 'Date?' operands
An optional may be nil, and then you cannot compare them. You would need to use taskDate! to unwrap the optional, but then if it is nil, that would crash the app. Another option is to use taskDate? but you'd need to provide a default value to use in case the date is nil, using ??. Another option would be to do: if let first = lhs.taskDate, let second = res.taskDate { return first.taskDate < second.taskDate } else { return false } Or something along that way. BTW, do you really need taskDate and taskTime, since a Date holds both the date and time information?
Apr ’23
Reply to Swift Core Data - Change Location of Persistent Store
defaultDirectoryURL is not a func but a class var: class var defaultDirectoryURL: URL { get } Actually it is also a class func. Sorry. Will take another look if I have the time. ... So, this: return super.defaultDirectoryURL() .absoluteURL(storePathURL) The func defaultDirectoryURL() returns the default directory URL. Then you wish to get the absolute URL of that directory by using .absoluteURL -- but that is a property, not a func, and thus it doesn't have parameters. And why would you use that since you want a totally different URL for your data? Maybe just return your storePathURL as an URL?
Apr ’23
Reply to Swift UI
You probably mean how to do that in SwiftUI, not UIKit/AppKit? Would you need this on iOS, macOS or a multiplatform implementation? For checkbox, use Toggle. For selecting a photo, I would use perhaps a Button or a Menu to initiate the user interaction and then import PhotosUI and use PHPickerViewController. Unless you are selecting the photo from the file system, not from the Photos app.
Apr ’23
Reply to Fatal Error
Check that the JSON contains what the Codable struct Game and the decoders/encoders expect. This works for me nicely: import Foundation struct Game: Codable, Identifiable{ var id = UUID() var title: String var normalPrice: String var sellPrice: String var steamRatingPercent: String var thumb: String } let game = Game(id: UUID(), title: "Test", normalPrice: "12.12", sellPrice: "10.00", steamRatingPercent: "10", thumb: "Yeah") let gameEncoded = try JSONEncoder().encode(game); if let encodedAsString = String(data: gameEncoded, encoding: .utf8) { print("\(encodedAsString)") } let json = """ {"id":"CCA746E3-CC22-44F4-AF51-9C012B8D9B52", "sellPrice":"100.00", "title":"Test 2", "thumb":"Yeah 2", "normalPrice":"112.00", "steamRatingPercent":"15"} """ let data = json.data(using: .utf8) let game2 = try JSONDecoder().decode(Game.self, from: data!) print("\(game2)") Printing out: {"sellPrice":"10.00","id":"CD7DD9E6-B314-4DCF-9F3C-43ED2C7B50DD","title":"Test","thumb":"Yeah","normalPrice":"12.12","steamRatingPercent":"10"} Game(id: CCA746E3-CC22-44F4-AF51-9C012B8D9B52, title: "Test 2", normalPrice: "112.00", sellPrice: "100.00", steamRatingPercent: "15", thumb: "Yeah 2")
Apr ’23
Reply to Swift UI
You have 16 elements in the VStack so @Claude31 is apparently right. Also you use hard coded offsets a lot. Maybe just let SwiftUI do the layout and control it using spacing, padding and Spacers.
Apr ’23
Reply to Device’s Orientation
Do you mean that when the phone is in horizontal position, you cannot see all the elements since they do not fit the screen? If yes, then either provide a different view with different layout for the two orientations or add scrolling to the view(s). Sometimes both to provide a good UX.
Apr ’23