UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

how to be independent of the courses

Forums > SwiftUI

I have been trying to learn swift and swiftUI. I have bougth several book an courses from here to raywenderlich, and udemy.

My problem is tha i don't know how to take the step from the books/courses/ tutorials.

At the moment i am doin 100 days of swiftUI, i understand the course, but i am not able to put a blank proyect and start there, i need the guidance of the courses.

Some idea on how to freeme from the tutorial trap??

Thank you

3      

Hi,

the answer is simple and yet complicated at the same time. You really need to do your own projects. Especially if you already have the fundamentals.

Is there app you are missing? Try to build it! :-) Or maybe none of the to-do apps work well for you? Try building your own.

There are lists of free APIs you can check out and maybe build on top of that. I also have this repo with some app ideas. They are probably not that great but might help you get started 😃

3      

thanx for thanswer.

Thats the biguest problem, i know the basics but apart from google it, is super hard for me to undestand apple documentation.

i want to do an sports app, but for example i read mapkit in the documentation, is like chinese to me. I know in 100days of swiftUI are a proyect of map, but I am trying to be independent from the tutorials.

thanks for the help

3      

Hacking with Swift is sponsored by Essential Developer

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.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Maybe in the Sports app you want to build, you can start with the stuff you know? And maybe find example projects via Google or GitHub and try to modify this code to work for your needs?

This will almost certainly be quite slow process compared to tutorials where the path is perfectly prepared. This is quite normal when starting out.

5      

ive never understood the Apple documentation.

and theres nothing wrong with googling things whilst you learn. you'll then get experience of implementing things without google

4      

Just start and take it one step at a time. Have a small app with little and basic functionality and expand it as you go. But starting is really the only thing you can do. It was daunting for me at first too, but as it stands I even brought an app to the app store! So can you! Good luck!

5      

I'm not sure if this will help or not. I was once a macOS developer who used a developer tool called SuperCard to create a few apps and I got to be pretty good at that and managed to release them on the Mac App Store. Unfortunately SuperCard is a 32-bit app that creates 32-bit apps and Apple now requires 64-bit apps. This has resulted in me basically starting over from scratch with SwiftUI (coming from the simplicity of SuperCard, Objective-C absolutely terrified me, Swift was far more approachable as a language and I picked up a few iBooks, but Interface Builder and Storyboards did not integrate very well to me and I quickly got very frustrated at how disconnected it all was, SwiftUI seems to have pulled it all together in a cohesive way that makes more sense).

I was honestly looking around for a way to learn SwiftUI that was macOS focused, but there is a surprising lack of materials out there for that and in the process I came across Paul's "100 Days Of SwiftUI"... for iOS. I asked Paul about it and about my concern that it was iOS and he assured me that, at its core, what I would be learning would be applicable to macOS as well and so I decided to give it a go. I'm really glad I did and I completed it around a month ago. I also then watched through Paul's subsequent Hacking With SwiftUI videos over on YouTube. I was happy to see that newer videos covered improvements in SwiftUI that were made after Paul had put together the course. I was happy to also see that Paul even covered some SwiftUI for macOS in some of those videos (though still not quite enough). I asked Paul about macOS and he kindly informed me that among the many things he is busy doing (does he ever sleep?), he is working on updating his macOS iBook to SwiftUI and hopes to have it available "soon".

Great. So, what do I do in the meantime? Well, SuperCard was only for macOS so I never really considered or thought much about iOS development, but now I have all this stuff I learned in "100 Days Of SwiftUI" and feeling that maybe I could just have some fun exploring that with iOS while I wait, especially if I can stay in the mindset of it just being a "fun" project and not take it too seriously or get too streesed out over it... (and here is where this reply may start to be relevant)...

I have always looked at programming as something of a jigsaw puzzle. I have a picture in my mind of what I would like to do in an app (what it looks like, how it works), but to make that picture a reality, I need to figure out all the pieces and how they fit together and assemble them and I try to keep that somewhat generic in my head. I could certainly give specifics of my apps, but in a general sense, they are all databases to make it easy to store and retreive some kind of information.

Where should I begin? Well I'm going to need a way to store data. In my SuperCard-based apps I was using SQLite, but Paul didn't mention that and I'm trying to work with pieces I am more familiar with for now... Paul covered some basics of Core Data and I know that Xcode has a template it generates to help developers get started. And so that was my starting point a few weeks ago. Xcode has a couple of checkboxes. One is to use core data and the other is to host it on iCloud. Oooh that could be fun. Paul didn't cover anything about iCloud hosting, but let me try that and hopefully it isn't too complicated even though I'm already straying away from the familiar. And... that doesn't work. The code is here and while organized a bit differently, it is recognizable from the stuff Paul had presented (this is good... I'm not feeling completely lost). Some searching around and I finally found out there were a few things I needed to set up in the project itself in Xcode for the iCloud stuff that were not in code at all. And then... it still didn't work. Apple's template is actually broken (it couldn't display the add button the way the template code was written)... hey, wait a second... Paul's tutorials covered adding a navigation view and putting buttons into there (maybe Apple should have taken Paul's course... lol). So finally, I've got Apple's template working... it creates a list and I have an add button that will add a current date & time stamp as an item. Let me just try this out on my iPod touch and my iPad Pro so I can see this stuff syncing through iCloud and... ah, it still doesn't work. Some more searching around the internet I find that there are a couple of lines of code needed to cause it to automatically update to keep the local core data and what is on iCloud in sync. (Incidentally, I was asking on this forum along the way how to solve all of this, but ended up going out there and finding the answers on my own while waiting so I ended up actually answering my own questions). And finally, I have a finished app. No, not really, but what I do have is a piece of the puzzle. I can run the app on my iPod touch and iPad Pro. I can tap the + button on my iPod touch and a new date & time stamp appears in my list. I can grab my iPad Pro and 15 seconds later see my new item magically appear. I can swipe to delete that date & time stamp on my iPad Pro and then grab my iPod touch and watch as 15 seconds later that line magically disappears. I'm assuming that 15 seconds or so is the default time Apple has set to check for the background notifications so it doesn't run down the battery as quickly. I had fun just adding and deleting items and watching them appear or disappear on the other device for an hour or so. It is just so cool. A real sense of joy in seeing it work. If this works on macOS (and presumably the core data and iCloud parts do), then this becomes a way to keep everything in sync and that is a really big deal!

But, as I said, it isn't a finished app but just one piece of the puzzle. So next I moved on to the Core Data stuff. It is great having this date & time stamp default, but I want to be able to add my own data. And now, I'm back to the familiar. Paul covered setting up Core Data entities and attributes in his course and a developer friend of mine answered a few questions I still had after that. Done. And another piece of the puzzle is there. I want to display a list with my data and maybe put a nice icon before each item in my list. Paul covers creating lists in many of his tutorials. Done... and with it another piece of the puzzle. I need an interface to add data because this isn't just a current date & time stamp that can be automatically generated. Hmmm... well, there are different options here. Paul covered one way, but let me dig around online to see what other options might be there... ohhh this looks cool... an add bar at the top of a list with a field to enter an item and a + button... I like that. Let me give that a try. @State, $, textField, button... all familiar from Paul's course. Done... but not quite... there is something bugging me, I could tap on my + button even if my field doesn't contain anything. I can check to see if my @State private var is empty or not and... yeah, there it is, a .disabled() that I can add on my button. That's better. Done. Putting in the stuff to enable swipe-to-delete and the EditButton()... yeah, Paul covers that in his course. Done... but... wouldn't it be nice if I could also maybe navigate to another view to edit the string for the line I tap on - maybe like Apple does when you edit a bookmark in Safari or edit a list name/color in Reminders (it is generally good to look at how Apple solves such interface problems when in doubt). Hmmm. More searching online and I find that, yes, it is possible to detect when you are in edit mode and with that you can conditionally change the view around a bit based on the state. Let me only have that section above my list to add an item appear only when not in edit mode. Let me have a navigation link to another view (just text for now) when I tap on a list item but ONLY when in edit mode. Ohhh, that is a few more pieces of the puzzle. It is still not a finished app by any means... but now there is a part of my picture that is taking shape. I will need more views with more lists and more editors... now I start to have the puzzle pieces available to me to make that a reality. Well, except I haven't made my edit existing item view or worked out the code for that just yet (Paul covered part in his course for creating and bringing up a view and I think I just came across a video explaining updating Core Data to watch) but there is another piece to this puzzle that is missing... I want my data to be unique. Paul did cover a way to do this in Core Data using Constraints, but that isn't available when you add iCloud to the mix. So I'm taking a pause on things and asking here and looking around online to see if that piece of the puzzle can be found. You know what is going to be cool... when I figure out the last couple pieces of this part of the puzzle... I will be able to add, delete, update an item in my list and watch it magically update on multiple devices. No longer just a default template interface with a default date & time stamp that I started with. Not a finished app. But something I'll probably sit here grinning from ear to ear playing with for an hour or so before I move on to working on the next puzzle pieces.

Anyway... is it the right way? Is it the only way? It is my way of doing it. Am I doing all this from memory? Nope. I am remembering that Paul covered "something" that I think might be relevant and digging back into 100 Days Of Swift UI to refresh my memory or checking out SwiftUI By Example or I'm searching around online for answers. Or I'm checking a visual reference guide I picked up from Mark Moeykens over at bigmountainstudio.com if it is just a basic interface element I'm trying to remember how to code. Or I'm asking a developer friend of mine by email. Or I'm posting a question here.

If my experience with SuperCard is anything to go by, over time I will gradually start to remember the parts I use most often and won't have to look them up every time. I will start to feel a sense of calm that comes with knowing that I have certain puzzle pieces available to me and it will replace the unease I feel right now as this is all still very new to me and I'm leaving the safety of just doing what is in some book or step-by-step tutorial exactly as it is written. I'm not to that point yet of feeling comfortable with SwiftUI (for iOS) and I won't really feel like I'm on the path of SwiftUI for macOS until there is at least one good iBook explaining that to me (menus, multiple windows, and other Mac specific features) to get me started.

Hope this helps,

Mike Yenco former macOS app developer and hopefully future macOS app developer and quite possibly aspiring iOS and iPadOS app developer

5      

Thanx every one for thanswer.

For me the problem is tha i watch the corses and i think i undertand everything, but the when i am "alone", i donn't know if i didn't understand or that i forgot.

for example @state properties i know that is for change the the visual in your app(sorrry for the short explanation) but it costme a lot to know why sometime you use $binding or without $, and when you are doing the courses, i am like "ok i get it".

Another thing is for example when you call functions su use the fuction xxxx() or xxxx without ().

i have made this app https://www.raywenderlich.com/17493408-your-first-ios-and-swiftui-app-an-app-from-scratch like 4 or 5 times. I can't do it on my own.

I have read that a lot of people where like me, and the one day every thing clik. hope that that happens soon.

Thank you

3      

It is possible that the func xxxx without () is actually a variable. Here are a number of ways to prepare and display a text string, showing different methods that could be used.

Of course this is just a simple set for clarity, and doesn't include extensions, and other methods and protocols, which could also be used.

As you are doing it already, best to keep it simple and experiment with the code to gain familiarity and understanding.

struct ContentView: View {

    var varTextView: some View {
        Text("Variable providing a text view")
    }

    struct structTextView: View {
        var body: some View {
            Text("Structure providing a text view")
        }
    }

    func stringTextView() -> String {
        return("String providing a text view")
    }

    func anotherStringTextView() -> String {
        "Another string providing a text view"  // Can omit the 'return' because the closure only has one, self-contained statement.
    }

    func thirdStringTextView() -> String {
        let x = 5
        let y = 4
        let z = x + y
        return(String(z))  // need a 'return' here because there is a series of statements
    }

    var body: some View {
        VStack{
            varTextView
            structTextView()
            Text(stringTextView())
            Text(anotherStringTextView())
            Text(thirdStringTextView())
        }
    }
}

4      

hi

if you'd like to try and build a screen or two of your app (although start with the easier screens) or the Ray Wenderlich app that youve tried before then happy to help on here as you go along with things you are stuck on.

that might be the middle ground needed between following the tutorials and going alone.

Richard

4      

Thanx for the answers.

for example, the other day iwas doing this part https://www.hackingwithswift.com/books/ios-swiftui/validating-words-with-uitextchecker

 func isReal(word: String) -> Bool {
        let checker = UITextChecker()
        let range = NSRange(location: 0, length: word.utf16.count)
        let misspelledRange = checker.rangeOfMisspelledWord(in: word, range: range, startingAt: 0, wrap: false, language: "en")
        return misspelledRange.location == NSNotFound
    }

And the first thing a I think is, how am i going to do that alone?

The secon thing i do is start cliking everything with the option key. if you click on range, is a time NSRange and i got crazy tryin to find want it is.

so my biggest problem is to find how to do it on my own becouse i don think if a i google how to know if a word is real in swift i am going to find the solution.

thank you in advance

3      

how am i going to do that alone?

Do you have to do that alone?

When I come across something like this I ask myself a series of questions such as:

Am I likely to need this functionality in my apps? Do I understand this enough to use it (as is)? Does it work for me (as is)? Is there some reason I would need to modify it to do something different?

Depending on the answers to such questions, that determines how I might handle that. It might be that it is a fun thing to experiment with but I don't really need it and possibly will never use it. I will make a bit of a mental note about it and where I saw it, but that's about it. Or it might be something extremely useful, and if I understand it enough to use (as is), and it works (as is)... then I can simply use it (as is) and I never really need to "do that alone" or worry about changing it... because it is right there already and does what I need. If I do need to modify it in some way, well, I'm not really starting from scratch here either and maybe with some searching I could find someone else who has asked about modifying it in the same way so even in that I might not be alone... or I could ask in a forum like this one if I'm stuck. And if it is that important to me I'll be bookmarking or saving it somewhere so it is handy and I will probably be using it in my own projects and then I'll just start referencing what I did there since that will be familiar within a context of something I built around that (which honestly helps me "get it" because it is doing something directly useful to solve "my" particular problem and is no longer just some solution to a generic problem in some tutorial project with less relevance).

It might also be something that will change as SwiftUI gets better so I'm not really all that concerned about memorizing everything I come across to just type in from scratch. It is important to know that SwiftUI is still relatively new and there are things that it can not do directly as you would expect in SwiftUI and so the workarounds are often more complex as they delve into older stuff created prior to SwiftUI. For example, Paul has a nice lesson in "100 Days Of SwiftUI" where he works with MapKit. At the time Paul wrote that part and recorded the videos, MapKit wasn't really integrated into SwiftUI and so the code was rather complicated and far less understandable (though Paul did a fantastic job of slowly walking through it). I don't need maps in my apps. I understood Paul's code enough to use it (as is) and it did work in the tutorial just fine. If I ever needed to do something with maps I could always go back to "100 Days Of SwiftUI" and look it up and modify from that... well... except... Apple changed it for the better in a SwiftUI update. In one of Paul's newer Hacking With SwiftUI videos on YouTube I watched he actually did a whole segment where he presented the new MapKit stuff... it is so much easier now... I still don't need maps in my apps, but I'll go checking on YouTube for that newer video or I will check in "SwiftUI by Example" where he updated it with the newer information if I ever do because that would be my best starting point.

There is another section of "100 Days Of SwiftUI" where Paul goes into painstaking detail about why changing a slider is updating its value in a control, but isn't working to update some related data to refresh a view... and there is a workaround. It isn't all that difficult and Paul does a good job of explaining it, but there is also something newer in SwiftUI now that replaces that with a single line. I haven't personally found myself in that particular situation yet and I can't even recall off-the-top-of-my-head what the new syntax is... but I'm aware of it being there and know I can look it up if a need arises. I also recall that Paul still favored his workaround because it did something-or-another that the native SwiftUI fix couldn't. Again... this is something I know I can look into if I start putting a slider into my UI and something else isn't updating as I expect as I move the slider around so I'm not actually all that worried about the particulars at this moment.

Here's the thing... I did not commit to memory how to work with MapKit with a long and complicated workaround. I did not commit to memory how I could get that data when my slider might not be passing it along. I can't just sit down, open an new Xcode project and start typing away all the code for such things. And that is probably for the best because... now there are other (better / far easier) ways so I wouldn't have to type something as long or complicated. At this point, I still even have to look up some of the simple SwiftUI syntax that is applicable to what I want to do (although I find I am getting a little better at remembering some of it as I use it more and more to solve stuff that is relevant to me). Don't feel you have to memorize every little thing. Don't feel you have to just sit down all isolated and, open up Xcode and start typing away. Don't feel like you can't use reference materials or look up things or ask questions on forums.

4      

thank you i try to ask but i feel like teaching a kid from crawling to walk.

i fell like this guy sais in the tutorial trap part of the video https://www.youtube.com/watch?v=cyCsLEVjzng&t=835s

thanks to everyone

3      

here i go again...sorry.

At the moment i am at day 35 on the challenge https://www.hackingwithswift.com/guide/ios-swiftui/3/3/challenge

and i have done the view, very basic, the problem is that i don now how to do the array or the struct for doing the loop over the questions.

i have look over the forum and i am blown away by the solutions, also have found this https://www.youtube.com/watch?v=FE4ys3tW1VI&t=3360s i know its not the same but... it is a help

This is my biggest problem, i undesrtand strucs or array but don't know how to use in a real example.

I think i must be able to solve the challenge with the things explained in the course up until now, no?

3      

ive not done the course but I think the idea is to create a struct for your questions (so youd have two vars in your question struct - one for the question text and one for answer text)

then you would create an array of questions

Richard

4      

Hacking with Swift is sponsored by Essential Developer

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.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

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.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.