|
Dear team I'm on day 61 of SwiftUI in 100 days. I'm just trying to write a bit of code myself but i'm struggling. I think most of my code is working (despite not being able to build it - so any comments welcome!) However it wont build. In my @main app file I get the error: 'ContentView' initializer is inaccessible due to 'private' protection level It's wanting me to put in some initial result for my results variable decared in my ContentView. However i have no initial values as this needs to come from JSON. There must be a way to create an instance of my struct without needing to fill it! Any help making this work would be reallly appreciated. In my list view i've only got one variable showing, i'll add more later but i need the first bit to work obviously! thank you
The test JSON data is as follows:
|
|
can you give it a try for your content View
|
|
Its a good try and I thought of something similar but it doesn't change. It still says the same error... Thank you for trying! |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
are you sure, i just tried this code and it gives AA1 1AA in the list, i hope there no other dependecy any where else.. |
|
I changed my main app file to:
and it worked! Thank you for your help! |
|
Layth! In 🏥 hospital, a crew 👩🏻⚕️🧑🏾⚕️🧑🏼⚕️ might cleanup for you after surgery 🩻. Here you have to do it yourself 🪣🧹! Please mark Amit's answer as "Correct" ✅. |
|
@Obelix: I usually get annoyed by trite overuse of emoji, but yours gave me a nice chuckle! Tnx! |
|
@Obelisk - haha maybe its because my day job is am anaesthetist Andy I'm used to it!! ill try to clean it up! do tou mean the layout and spacing etc are messy or the code is not clean/good? |
|
Dr Layth asks:
Not at all. What I meant was marking an answer as "Correct". Since this is your patient, only you can select the correct answer. But marking it as correct is a necessary step. This way your colleagues don't continue to visit this patient for a diagnosis. By marking it as |
|
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.