Swift is not easy


#1

Try swift, bought a book immediately as it was thrown to the market, but most of code outdated not compileable. Found a forum, seems to be professional. Latest code 3 days old, not compileable. X-Code update makes it even worst. Understandable but f...g inconvenient. Why Apple extol swift as a simple language but do not offer an up to date book with examples that work with the current x-code there is no nothing help. I have more success to satisfied apps with c++, c, of course c-# - is the best, JavaScript, Java all this languages are simply learnable and get soon thrilled by the yields. But not so by swift. Very uncomfortable to learn.

If I am wrong, please give me some counterexamples/ exceptions.


(Dale Buckley) #2

Swift has admittedly evolved a lot over the past few years, but it's all been done for the right reasons.

If you need some up to date documentation you can find it on swift.org: https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html
There is also a book released by apple here: https://itunes.apple.com/gb/book/the-swift-programming-language-swift-4-1/id881256329?mt=11


(Joanna Carter) #3

I have been programming for over 25 years. I started in Cobol, followed by C, dBase, Pascal, C++, Clipper, Delphi, C#, Objective-C and now Swift.

Each language has its own learning curve but, in fact, it's not so much the language that is difficult, it is the accompanying libraries that take some learning.

From many years experience programming in C#, I would say there is not a lot of difference in the complexity of the two languages. C# is more mature and, as yet, Swift has some catching up to do.

I would highly recommend the two links that Dale mentions. The first is very succinct and clear.

I, for one, find Xcode to be very helpful in the code completion and syntax checking it provides.

As Apple suggest, you can use Swift at a very simple level to start with, then you can move on to learn the more advanced features it provides.

After more than 25 years, programming, I can tell you, Swift is by no means the worst language :sunglasses:


(Alex Martini) #4

The links @dlbuckley posted have the same content, just in different forms.

I'll add one more link, in case it's helpful. "The Swift Programming Language" assumes you have some background in programming. "App Development with Swift" is written without assuming you have programming experience.


(Adrian Zubarev) #5

See 'download the latest version as an ePub', it's always up to date.


#6

I mean, not the language it self is difficult but the possibility to follow an 3 days old example.
I want to develop an app using CloudKit, first of all to get my data to the cloud. Use the Apple cloud to store my data in there. And using such a project to learn the use of the CloudKit.


(Patrick Gili) #7

I highly recommend checking out https://www.raywenderlich.com.

When I first started iOS programming (before Swift), I used this website to learn some of the fundamentals. The free tutorials are informative and useful. The site paid tutorials, which go deeper, but I have never used them.

However, they site also offers books on a variety of topics, including https://store.raywenderlich.com/products/core-data-by-tutorials. I bought this particular book because it goes into CoreData integration with iCloud. You might find this useful.


(Joanna Carter) #8

In that case, you need to post a message on the Apple Developer forums. Not here in forums dedicated only to the Swift language


#9

Yes, I try but I am always forwarded to the current site.


#10

If I buy this book and than some days later I got the book and the examples are not reproduceable.

And I do have also this feeling like I have to study Objective-C first. Could it be?
If you go a little bit deeper as hello world and has to use a framework you stumble over Objective-C or some awful wrappings of objc code and if something do not work you need to know that f...g objective-c. This is like swift is a beautiful silly wrapper and objective-c is the workhorse.

I hate this situation, it does not help to learn this great language, there is nothing I could do with that “great” language without a framework written in objective-c.

If I am wrong please set me straight.


(Patrick Gili) #11

Nah. This book is native Swift 9.x. Will the examples work without modification? Probably. Swift 9 to Swift 10 wasn't supposed to break source.


(^) #12

you need to chuck that book, swift is currently on version 4.2. I would stick to The Swift Programming Language and these forums for reliable information.


(^) #13

Probably. most Swift books seem to be written for version 3 or earlier and a lot of them make assumptions about Apple platforms and available frameworks that would cause the examples to not work elsewhere

no.

no. Swift is the workhorse and objective c is the thing attached to it for backwards compatibility. the support is there so that if you were originally an objective c person and you had an objective c library you like then you could keep on using that same library in swift instead of having to relearn (or write) a native library. but by no means do you have to do that, in fact a lot of people consider it “unattractive” swift

Saying swift requires objective-c because Foundation written in it is like saying python requires c because pickle is written in it. 99% of python people will never need to know or care that pickle isn’t written in python and 99.9% will never have to write a line of c for a python project. Swift is like that too, in fact i would argue pickle (considered part of their standard library) is a lot more tightly coupled with python than the apple frameworks (considered 3rd party libraries) are to swift. It’s true lot of people who use swift also tend to use objective c, and use them together, but by no means do you need to know objective c for a particular project if it didn’t already require you to use objective c before you decided to write it in swift.


(Patrick Gili) #14

Actually, the Core Data Tutorial on raywenderlich.com was just updated to today for Swift 4.2 and iOS 12.


(Joanna Carter) #15

There is no such animal as Swift 9 or 10; those numbers refer to the Xcode development environment.

If you got to https://forums.developer.apple.com/welcome, you will not get forwarded to here. It is the home of Apple's forums for everything except Swift and is where you need to be asking questions about the Cocoa and UIKit APIs like CloudKit, etc.

I will repeat myself - these forums are dedicated to the Swift language, nothing more.


#16

Do you support only Linux, I mean what could I do with your version of Swift, what is possible how to imagine, does this forums also support Apple platforms, of course without Apple frameworks, but despite this, do you, do this platform also sup apple dev. On Apple platform


(Joanna Carter) #17

Swift is a programming language, originally created by Apple, or more specifically, by a team of developers led by Chris Lattner at Apple.

At first, it was entirely aimed at Apple's own development eco-system but was made an open-source project in 2015 and, as such, is being developed, not only for Apple platforms but, also, for others like Linux and maybe even Windows.

These discussion forums are part of that open source project. They are not here for the discussion on how to use Swift for macOS or iOS. For that, you need to look at the Apple developer forums; particularly for help with the Swift language, you should go to https://forums.developer.apple.com/community/xcode/swift. You can also find help with the various frameworks from the main welcome page I mentioned in my last post.