Post

Replies

Boosts

Views

Activity

Reply to What would be the proper Syntax
Or if you want to skip ahead to more advanced Swift usage (without the early return optimization), consider this: func isPassingGrade(for scores: [Int]) -> Bool {     scores.reduce(0, +) >= 500 } There’s no explicit sum() function in the Swift library but this reduce() expression is equivalent. And reduce() is well worth getting familiar with.
Topic: Programming Languages SubTopic: Swift Tags:
May ’22
Reply to problem with a series of if statements
Definitely unexpected based on the limited code you posted. I’d add more sanity checking by also printing the value of the tested value within each block: if viewModel.npH < 7.35 { diagnos.resultado1 = "acidemia" print("4", viewModel.npH) } Does this turn up any incorrect assumptions?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to TabularData Framework: crash on opening CSV file
First, consider submitting a bug report and then post the Feedback ID here. But unfortunately I think the biggest issue may be this line in the documentation: Import, organize, and prepare a table of data to train a machine learning model. That sounds like the whole tabular data API is intended as a developer tool rather than a general-purpose CSV parser for production code. So it’s not totally unreasonable if it assumes well-formed data comes from upstream in your workflow and throws a fatal error if this precondition doesn’t hold. Look in your debug output for helpful troubleshooting messages like the ones @eskimo quoted above. Since you need bulletproof parsing and error handling for untrusted user-supplied data, this API probably isn’t the best tool for the job.
Topic: Machine Learning & AI SubTopic: General Tags:
Jun ’22
Reply to Swift Post request ,Django backend
what should I do? Provide more information about your problem. 😉 What is that “result” string: the body of the server response, something in the server log, something else? Assuming you get a valid HTTP response (though not shown in your code), what is the status code: 200? 4XX? What is the body of the response? You don’t set a Content-Type: application/json header. Does your server require that header in order to handle the request?
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’22
Reply to Add Return key subview to keyboard
I need to add a Return key to a numeric keyboard (BTW, how is it it does not exist in standard ?) Any chance you can just do this with an inputAccessoryView? That’s a supported API and It Just Works™. I guess I have to add subview to something else than UITextEffectsWindow (keyBoardWindow), but to what ? I’m sure you know this already, but (for those in the wider audience who may not know) poking around in a private, undocumented view hierarchy is fragile and unsupported. That way madness lies.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’22
Reply to Add Return key subview to keyboard
I also tried to debug view hierarchy, but keyboard does not show in debugView. FWIW, I can see the keyboard window in the view debugger, but it’s in a special separate scene rather than the main scene. And in the memory graph I can find no path to access it. So this proposed hack would be not only tricky and fragile, but seemingly impossible. File a feedback asking for what you'd like to see but that currently does not exist Run the keyboard out-of-process like SFSafariViewController so people can’t even begin to try to hack it. 😉
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’22
Reply to Default Keyboard Toolbar
Do you mean in web pages you design (and view in Safari) or do you mean in an app you are building? For web pages that’s just what Safari does. For a custom app, take a look at the inputAccessoryView property on UITextField and UITextView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Try to Connect Bluetooth Device
Are we able to connect this Bluetooth Device using Core Bluetooth? The screenshots show it’s a BLE device and advertises that it’s connectable, so Core Bluetooth should be able to connect. (Assuming you haven’t tried yet.) The bigger question is: do you know how to use those services (0xFFE0 and 0xFFF0), if those aren’t your own design?
Jun ’22
Reply to Try to Connect Bluetooth Device
Are we able to connect this Bluetooth Device using Core Bluetooth? According to the screenshots it’s a BLE device and advertises that it’s connectible, so yes Core Bluetooth should be able to connect. The bigger issue is that once connected, do you know how to use those services (0xFFE0 and 0xFFF0), if not your own design?
Jun ’22
Reply to Filtering an Array
it says the title is a string that is not optional But the compiler disagrees, as the error message basically says the title property is an Optional<String>. Can you show the definition of the Recipe type?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22