Sign in to follow this  
Navyman

Swift - Love it or Hate it?

Recommended Posts

Swift - Apple's new programming language has developed over the years and while there have been some growing pains between updates I have found it a much smoother method of creating apps.

 

There are a few minor pains that I have found to not agree with, but I would like to hear some other options.

Example Issue:

The removal of ++ & -- because they are too C++ like.

Share this post


Link to post
Share on other sites

Don't hate it but dislike it.  Been developing iOS apps since 2008.  All my colleagues are die hard apple fan boys who think anything created by the mothership must be genius but, I've used lots of other languages and can see where Swift has tried to take inspiration.
 

Share this post


Link to post
Share on other sites

It's neat, I like it. I find bridging between C++ to be more cleanly and easily accomplishing with Objective-C(++) still, though, so I don't end up using as much Swift as I'd like on any sort of mixed-language project.

Share this post


Link to post
Share on other sites

It's neat, I like it. I find bridging between C++ to be more cleanly and easily accomplishing with Objective-C(++) still, though, so I don't end up using as much Swift as I'd like on any sort of mixed-language project.

 

Is that possible then? I'd always assumed that choosing Swift meant choosing not to use C++ in any way, so had completely rejected it as an option.

Share this post


Link to post
Share on other sites

Is that possible then? I'd always assumed that choosing Swift meant choosing not to use C++ in any way, so had completely rejected it as an option.

 

The same way you can do it for any other language, thanks to an amazing technology from the 1960s:  The Linker.

 

Programs are built from all kinds of libraries, archives, or modules, depending on how things are named. All the libraries get linked together into the final executable.  It doesn't matter if the libraries were built in Swift, C++, C, Assembly, Fortran, or anything else, but they all follow a basic naming system and parameter-passing system and other rules that form a common interface.  As long as all the code was compiled to match the same interface -- called the application binary interface -- all the parts will work together.

 

Although the interface actually predates C, it is often called a C-style linkage or extern "c" or similar.  

 

Swift calls it a "Bridging Header".  Google finds this little example among many.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this