Learing xCode + Swift - is it really this hard?

Hello,


I have started learning iOS programming (not for the first time, I gave up once in the Obj-C era). I am new to programming, and after having worked my way through Swift playgrounds on iPad I find myself banging my head against the wall when trying to get to the next level. I am about 2/3 of the way through Apple's "App Development With Swift", and I have also worked through the first half of Wenderlich´s iOS Apprentice. (The Wenderlich book does spend 300 pages on making a to-do list, which did wear me out).


After the very basics of functions and very very simple apps, I find it incredibly hard to get to the next level and actually creating something myself from scratch. Apple's tutorial being rather full of errors does not help, but i find even "simple" things like table views very hard to get the hang of using Apple's book.


I started learning because I have an idea for a simple - in my mind at least - app. The app would be Mapkit based and show all features of type x inside area y. For instance, all Irish pubs in Ireland (this is not what the app would do, but the principle is the same; all points of interests of a particular type in a particular area). The user will be able to tap each map annotation for more information which will be stored as Ints, Strings and Bools, for instance: numberOfSeats: Int, pubName: String, hasPoolTable: Bool, [beersOnTap] etc. Then the user could store his favourite pubs and see a list view of the nearest


I thought I would be able to learn the basics and then start creating the app, learning more along the way. But after working on various books and tutorials for months, I am still utterly clueless as to where to start. I can't even find out how to make a map annotation clickable and show a seprate view with info for the object.


Am I approaching this the wrong way by trying to learn what Apple defines as the basics before starting? I don't want to approach this by copypasting mapkit tutorials without really understanding what's going on in code, but perhaps that is a better way?

Replies

It is normal you feel lost at beginning. This is because IOS API is very rich and thus complex (and Apple doc is very often just a reference, not really helpful).


Swift is (I find) reletively easy to learn and your are now familiar with it.


You're riight, never copy code without understand exactly what it does.


I would suggest :

- get some simple app example (you can find a lot on Internet), that will help you see how it is structured

- then select the right app type in XCode (to start, I recommend sinle view app)

- design just a few view controllers to build the basic app structure (you will certainly have to change later, but it will be your initial frame):

initial view

tableView

view to display an item, where you will use Mapkit (here you can look in detail a Mapkit example)


For answer to question as Clickable annotation, searching on web will always provide help.

I searched with "swift make annotation clickable"

and found for instance

h ttps://www.hackingwithswift.com/example-code/location/how-to-add-a-button-to-an-mkmapview-annotation


or with didSelectAnnotation


h ttp://swiftdeveloperblog.com/code-examples/didselectannotationview-handle-user-tap-event-on-mkannotationview/


Wish you good luck.

I signed up to the Developer Program when it was first launched over a decade ago, and back then the Apple documentation was all there was. There weren't any online tutorials yet. Luckily the documentation was very good, and they had a lot of tutorials that helped you learn.


If you're new to programming then yes, it'll be a massive challenge. I've been a professional Software Engineer for more than 20 years, and I've worked with plenty of other Software Engineers who simply would not cope with the concurrency aspect of iOS Development, yet it's practically a fundamental for iOS Development. It's not a beginner topic. iOS isn't really a beginner ecosystem. You're thrown into the world of design patterns and concurrency with zero experience as a programmer. When I was in uni, it was fairly normal to teach students a proceedural programming language first and then graduate up to an object oriented language like Swift.


I can understand your enthusiasm for wanting to develop a cool app immediately, but if you're really deteremined to stick it out for the long term, it might be beneficial to take a step back and spend sometime on the basics and get a good grounding in Swift. Especially if you're feeling completly lost. Perhaps write some command line apps first. I couldn't imagine ever having the patience to sit through a 300 page tutorial for a list app.


What I did was make learning the goal, in my first 6 months. I tried to complete as many different tutorials that Apple had as possible, so that I could learn by doing. If I felt lost, I'd stop and try a different tutorial that wasn't so confusing. Could I really follow and complete a tutorial on UINavigationController when I didn't even know what a ViewController was or how to use it? For example, MapKit involves views. Have you spent any time reading and learning the View Programming Guide, or the View Controller Programming Guide as a start? In my experiences, becoming comfortable programming in the iOS environment involves a massive amount reading. The more I read, the more I knew, and the more I understood. That gave me the confidence to try new things, and experiment. It also helped to spend time learning more about the tools I was using. Especially debugging tools, in the early days when you're trying to track down your first ever race condition due to mistakes made with concurrency code.


Right now, after 4+ years away from iOS Development I'm spending months just getting back up to speed with their data related frameworks like Core Data and CloudKit, so that I don't end up design and implementing a lemon of a data model and app. It's a big commitment, but it's worth it. I've probably watched at least 80 WWDC videos in the last 3 months. iOS really is an environment where you need to do your homework. But if you want to be a better developer, then it's a great place to be.

I suggest a computer science degree at a local college or university. Anything Apple publishes is going to assume such a degree. What a degree program gives you is a learning path appropriate to where you are. If you try to do too much at once, you get lost and can't make any progress. Building a modern app, and doing it properly, is extremely complicated.


What you are describing is actually a GIS (Geographic Information Systems) application. Apple's GIS technologies, including MapKit, are some of the worst in the industry. The simple task you have described cannot actually be implemented in MapKit. MapKit lacks the basic GIS functionality to do it. MapKit can't do much more than give you directions to the mall.