Post

Replies

Boosts

Views

Activity

Reply to Implement .searchable into existing list in SwiftUI
Hi, You might want to check this article: https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-search-bar-to-filter-your-data A more correct way to do what you want to achieve would be to create a struct or class representing a medicine, and then an array containing the actual medicines that you want to display. Then, you would create your list by iterating over this array. And you could display the search results in this list, like the article explains it. Hope it helps!
Nov ’23
Reply to Need a help
Hi! You might be interested by this free course created by Apple: https://developer.apple.com/tutorials/app-dev-training But before you get started with that, I recommend that you have a basic understand of Object Oriented Programming (OOP). If you're completely new to programming/computer science, you might also want to check Harvard's CS50, available entirely for free on YouTube, or at this link: https://www.edx.org/course/introduction-computer-science-harvardx-cs50x It helped me a lot! Have fun coding!
Jul ’23
Reply to Creating a dynamic 5X5 Matrix
From what I've understood, it doesn't need to be 5 dimensional, but rather, 2 dimensional. The dimension in a matrix doesn't correspond to the number of rows and columns. In your case, two dimensions seems enough: one for the severity (from one to five), and one for the likelihood (1 to 5). You could therefore store data like so : Matrix[2][5] = 3 (which would mean that there are 3 questions that have a severity of 2 and a likelihood of 3). A good visual representation of the dimensions of a matrix would be the following. A one-dimensional matrix is just an array/list. A two dimensional array corresponds to an Excel/Numbers spreadsheet. And a three dimensional array could be use to store the coordinates of the cubes composing a Rubik's Cube, for example. Above 3, it's hard to have a visual representation. A 5-dimensional matrix would be suitable if you had 5 different sliders per question. Therefore, if you can represent your table in a spreadsheet, it means that two dimensions is enough. Let me know if my answer is suitable for your project! :)
Jul ’23
Reply to Creating a dynamic 5X5 Matrix
Hi! I didn’t really understand the things that you want to store in your matrix, could you please explain that better? Why do you need 5 dimensions? I feel like using such a matrix for storing data is not a good idea and might not be easy to work with. You might be interested in learning more about Object Oriented Programming (OOP), and maybe store each question’s data inside a struct or a class that would represent a question.
Jul ’23
Reply to open a New View from a item in a contextual menu
Could you please provide more context? Maybe a screenshot of what you would like to accomplish? What I can say for now is that you didn’t write anything into the “HelpView” button action. Therefore, it doesn’t do anything. To learn more about SwiftUI, you might be interested in the following course : https://developer.apple.com/tutorials/app-dev-training
Jul ’23
Reply to Can I use SF UI Text font in a web application?
Hi! When installing SF Pro from Apple website (https://developer.apple.com/fonts/), you can read this in the license: IMPORTANT NOTE: THE APPLE SF PRO FONT IS TO BE USED SOLELY FOR CREATING MOCK-UPS OF USER INTERFACES TO BE USED IN SOFTWARE PRODUCTS RUNNING ON APPLE’S iOS, iPadOS, macOS OR tvOS OPERATING SYSTEMS, AS APPLICABLE. So the answer is: no, you can't use SF Fonts in a web app.
Jul ’23
Reply to Trouble with Persisting One-to-Many Relationship Data in SwiftData, What am I Missing?
Solved it! In case anyone is wondering, the problem occurred because I'm also storing an enum case in my Interaction class, which is a known issue in iOS 17 Beta 2. The workaround was to store a String and then "translate" it to an enum type using a computed property. The computed property is declared as @Transient, so it's not stored. And it works perfectly fine!
Jul ’23
Reply to Learn to Code 2 > Variables > Three Gems, Four Switches
The behaviour you are seeing is actually as expected, due to the way logical operators work in programming. When you use an OR (||) operator in your while condition, it means the loop will continue to execute as long as at least one of the conditions is true. So in your case, the loop will keep running if either gemsCollected < 3 OR switchesToggled < 4. Therefore, even if you have collected 3 gems, but have not toggled 4 switches, the loop will continue to run because the switchesToggled < 4 condition is still true.
Jul ’23