And the code that causes the crash?
Post
Replies
Boosts
Views
Activity
I wouldn’t put that file in git. Surely you do not want to version the state of Xcode UI? It keeps changing as the user interface state changes.
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.
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?
Hello and welcome.
What is it that you actually expect to see? What is the code looking like to produce what you wish to see? Is it just the visual appearance that is wrong, or some functionality too?
Could it be this:
notificationClass["user"] = PFUser.current()
notificationClass["fromUser"] = PFUser.current()
The user and fromUser are the same -- PFUser.current().
You could do that with an app. A development idea for you, perhaps.
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?
Does not work for me. Unlike this post, the linked one does not have the Your Reply textbox below. Also pushing the Add a comment link does nothing.
On iOS and macOS you can also use the fileImporter View presentation modifier, if you wish to import an image file, instead of selecting a photo from the Photos app.
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.
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")
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.
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.
Well if you try to imagine us imagining what your code looks like, you would see some confused faces.
We have no idea without seeing your code. It could be anything.