Swift resources for Flash and ActionScript developers

Hello, fellow Flash developer!

Did you find this page while looking for “the #Swift equivalent of this #ActionScript piece of code”? Or are you looking to transfer your #Flash skills into native #iOS development? In either case, you are in the right place.

If you have spent some time making Flash apps and coding in ActionScript, you are well on your way to knowing your way around Swift and won’t need to start from scratch. We have collected some resources that can help on your learning journey: they have been created with your experience in mind and by developers who speak your language – after all, they have made the same transition!

We have tried to systematise the available material and give you a sense of where you can start if you are new to Swift and where you can dig deeper:

  • Online articles for when you need quick info on specific topics.
  • Books for when you are ready to take the plunge.
  • SDKs if you want to get your hands dirty right away.

 

Online articles

1. Yeah, but is it Swift?

Christopher Caleb

If you are new to Swift and need a crash course that will help you hit the ground running, start here.

YeahButIsItSwift.com offers a series of articles by Christopher Caleb, whom most of you know for his Flash, Adobe AIR and HTML5 tutorials published on YeahButIsItFlash.com and in his Flash iOS Apps Cookbook.

The series has four parts, but don’t let the modest number of posts on the website fool you. Each part covers a lot of ground with simple and easy to follow examples.

Here is what you will find inside:

Part 1 helps you set up a Playground in Xcode – the IDE, which you will be using to create apps with Swift. The introduction to Swift starts gently with looking at its syntax and gradually leads to specific topics such as Optionals and their application in the language.
See contents...

  • Setting up a Playground in Xcode and writing your first line of code
  • Comments
  • Variables and constants
  • Types and type inference
    • Integers
    • Floating-point numbers
    • Boolean
    • Strings
      • Printing values
    • Type conversion
    • Tuples
    • Optionals
      • Forced unwrapping
      • Optional binding
      • Implicitly unwrapped Optionals
  • Basic operators
    • Assignment operator
    • Arithmetic operators
    • Remainder operator
    • Increment and decrement operators
    • Compound assignment operators
    • Logical operators
    • Range operators
  • for loops
    • for loop
    • for-in loop
  • if statements
    • if statement
    • if-else statement
    • if-else else-if statement

Part 2 builds on your knowledge of the Swift basics learnt in Part 1 and expands it to include container types and more powerful control flow techniques. It also introduces Enums – something that’s been missing in ActionScript 3.
See contents...

  • More on Strings
    • Characters
    • String interpolation
    • Character indexing
  • Arrays
    • Initializing arrays
    • Accessing and modifying an array
    • Accessing outside an array’s bounds
    • Iterating over an array
  • Dictionaries
    • Accessing and modifying a dictionary
    • Iterating over a dictionary
  • While loops
    • while loop
    • do-while loop
  • Switch statement
    • Explicit fallthrough
    • Range matching
    • Tuples
    • Value binding
    • where
  • Enums
    • Conditional statements
    • Raw values
    • Associated values

– In Part 3 you start writing and using functions and learn how Swift handles parameters and return values. It also presents Structs: something that is a bit like an Object in ActionScript 3, but not quite…
See contents...

  • Functions
    • Parameters
    • Return values
    • Returning tuples
    • Local and external parameter names
    • Default parameter values
    • Variadic parameters
    • Constant and variable parameters
    • In-out parameters
  • Structs
    • Instantiating a struct
    • Accessing properties
    • Structs are value types
    • Custom initialisation
    • Initializers and external parameter names
    • Initializer delegation
    • Computed properties
    • Read-only computed properties
    • Property observers
    • Type properties
    • Structs as constants
    • Methods

Part 4 of the series takes you into the OOP realm of Swift and you learn how to use classes, how they differ from structures, how initialization and property observers work.
See contents...

  • Classes
    • Instantiating a class
    • Classes are reference types
    • Classes as constantsIdentity operators
    • Properties
      • Type properties
      • Property observers
    • Methods
      • Parameters
      • Return values
      • Default parameter values
    • Type methods
    • Initializers
    • The self property

Yeah, but is it Swift? was among the early tutorial series to appear online and the code in the examples works with earlier versions of Swift. There are plans for an update to Swift 3 soon, however, so watch this space.

2. Before I forget…

Craig GrummittOnce you have the basics covered, you will probably want to dip in and out of certain topics as the need arises. Craig Grummitt‘s blog, unassumingly titled “Before I forget…”, contains a series or articles which deal with some of the specifics of Swift. It also shows you how to work with user interface and manage your projects in Xcode.

Craig publishes his blog posts as notes to himself, in order to avoid a situation we are painfully familiar with: having to solve the same problem again when it sneaks up on you months after you have first found a solution for it and can’t remember what it was. Thus the blog title, you see. So it’s easy for some of these article gems to sink down the blog feed and become hard to find. We have tried to put them into categories for easier navigation – click on each category to see the topics in it:

Language features
See contents...

User interface
See contents...

Cookbook tutorials
See contents...

Xcode tips
See contents...

But this is not all! If you find these articles useful, you will be thrilled to know that Craig has a whole book on Swift, which is pending publication very soon. More on this in a bit…

3. The Swift series

Thibault Imbert - the Swift seriesWhen you are ready to jump into deeper waters, check out The Swift Series by Thibault Imbert, published on TypedArray.org.

Thibault is known for looking beyond the obvious and presenting complex topics in an easy to follow and understand way. We have been fans of his articles since the ByteArray.org days, where he dug deep in topics on ActionScript, JavaScript and the like.

His articles and tutorials will help you understand behind-the-scenes topics like memory management in Swift and how it compares to using garbage collection in ActionScript, for example. It will also give you ideas for things you can do with graphics and data. Thibault finds it hard to stay away from binary! We love that. 🤓

 

 

Books

5. Migrating to Swift from Flash and ActionScript

Migrating to Swift from Flash and ActionScript - front coverWe couldn’t publish a list of Swift resources without shamelessly plugging our own book, “Migrating to Swift from Flash and ActionScript”. We have designed it to be a one-stop-shop in your transition to Swift, using Xcode and making iOS apps by building on your prior knowledge.

The book guides as you adapt not only to a new programming language but also to a new set of programming tools and workflow. You can read it from cover to cover or use it to refer to the topics you need in whatever order you need them – pretty much all chapters are self-contained.

Part I: Your new tools
It can be frustrating when there is work to do and stuff to set up before you can run your first line of code on a device and only Google to search for answers. This part of the book helps you breeze through that and shows you what Xcode has on offer in terms of development tools.
See contents...

  • Chapter 1: Setting Up Your Environment
  • Chapter 2: Hello, Xcode!
  • Chapter 3: Introducing the Xcode Debugger
  • Chapter 4: Additional Development Tools

Part II: Your new workflow
All set up, now how do you create your user interface? How do you make it adjust itself to different screen sizes and orientations?  How do you get code to run in the background and how do you make the most of the debugger? This part of the book deals with these and more workflow-related questions.
See contents...

  • Chapter 5: “Hello, Swift!”—A Tutorial for Building an iOS App
  • Chapter 6: Adding a More Complex UI
  • Chapter 7: Concurrency
  • Chapter 8: Debugging and Testing Your App

Part III: Your apps
This part comes with 12 self-contained tutorials for practical apps you may want to build: from posting to social networks and using the camera to producing high-end graphics.
See contents...

  • Chapter 9: Communicating: E-mail, Text Messages, and Calls
  • Chapter 10: Getting Social: Posting to Facebook and Twitter
  • Chapter 11: Knowing Your Location
  • Chapter 12: Working with the Camera and Images
  • Chapter 13: Working with Data
  • Chapter 14: Networking
  • Chapter 15: Adverts and Push Notifications
  • Chapter 16: Using the High-End Graphics APIs

Part IV: Your new language: Swift distilled
You have been learning how to code with Swift throughout the whole book. However, it is helpful to have a reference, which is focused on the language itself. Here Swift is presented from the point of view of your current experience with other OOP languages, especially ActionScript 3.
See contents...

  • Chapter 17: Swift Language Basics
  • Chapter 18: Operators
  • Chapter 19: Types
  • Chapter 20: Control Flow
  • Chapter 21: Object-Oriented Programming Topics
  • Chapter 22: New and Different Concepts

Bonus Chapter: Releasing Your Apps in the App Store
That’s the point of making apps, right? Releasing an app in Apple’s App Store includes jumping through hoops that are far from intuitive… We hope that the tips in this chapter help you navigate them and have a smooth sail.

“Migrating to Swift from Flash and ActionScript” is available from all major booksellers. Find out more and preview selected chapters here.

4. iOS Development with Swift

grummitt-ios-hiThis is the new book by Craig Grummitt we mentioned earlier. Craig is working on it as we speak (ok, as I write and you read) and it’s very exciting to see new chapters appearing on the publisher’s website in real time thanks to the Manning Early Access Program (MEAP).

It has a gradual approach in taking you from zero to becoming a proficient Swift developer.

– In Part 1 you get familiar with Xcode as your new IDE, try out Swift in a Playground and make your first app with it.
See contents...

  • 1. Your first iOS application
  • 2. Introduction to Swift in the Playground
  • 3. Swift Objects

Part 2 helps you with building your app’s user interface and understanding Layouts and user interaction among other things.
See contents...

  • 4. View Controllers, Views and Outlets
  • 5. User interaction
  • 6. Adaptive layout
  • 7. More adaptive layout
  • 8. Keyboard notifications, animations, and scrolling

Part 3 shows you how to build the backend of your app and deals with topics from working with data and iCloud to threads and networking.
See contents...

    • 9. Tables and navigation
    • 10. Collections, searching, sorting and tab bars
    • 11. Data persistence
    • 12. Data persistence in iCloud
    • 13. Graphics and media
    • 14. Networking, libraries and threads
    • 15. Debugging

Part 4 adds finishing touches to app development: testing your code and distributing your app.
See contents...

      • 16. Testing
      • 17. Distributing your app

At the very end of the book, you will find Swift syntax cheat sheets for quick reference.

You can see a short presentation of the book here, and follow the book’s progress and download Chapter 1 for free from the publisher’s website. We are looking forward to the book’s release in July 2017!

 

SDKs

If you are a ‘ready-fire-aim’ kind of learner (aren’t we all?!), you may want to take Swift into a familiar corner, use it for a bit and then commit to reading books and articles about it. Wouldn’t it be nice if there was an API for that? Well, read on, you are about to discover one.

6. Swift API for the Flash Guy

swiftapifortheflashguy

This has to be our personal favourite: an ActionScript 3 SDK in Swift by… Craig Grummitt again. What can we say, Craig is a prolific writer and programmer!

If you are a die-hard ActionScript coder who would prefer a veeery gentle transition to Swift, give this SDK a go. It has been aptly named ActionSwift3 and is designed to make your first Swift projects feel as if you are still programming in Flash with ActionScript 3.screenshot

Craig has ported pretty much all you need to make a viable app: from basic classes like Object, DisplayObject, MovieClip and Scene through classes for event handling, designing your user interface and, get this: even data types that you’ll be familiar with from ActionScript 3.

The SDK comes with a tutorial for porting your first Flash game, called “Flashy Bird”, into Swift. This is a clever trick: while you remain wrapped in cosy and familiar ActionScript 3 working on this game, by the end of the tutorial you will not only have made your first steps in Swift, but will have also set up your Swift development environment: Xcode with Cocoapods and will have learnt how to use third party libraries to boot.

The SDK is open-sourced, up-to-date with Swift 3 and is available on GitHub.

 

Give us a hand

We hope you find this collection of resources helpful on your way to learning Swift. This relatively new language, however, and the knowledge about it, evolve with impressive speed and new learning materials become available by the minute.

Do you know of other resources that may help a Flash developer get to grips with Swift?

Post a comment below and help us keep this page up-to-date.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

Comments

  1. FreSwift
    Air Native Extensions are awesome. Swift is awesome. So let’s combine to the two…
    Bring your ANEs into the now by using AIR 28 and this iOS framework to extend your AIR apps with Swift coded native functionality.

    This framework wraps FlashRuntimeExtensions with Swift based syntax.

    let airString = String(argv[0])
    trace("String passed from AIR:", airString)
    let swiftString: String = "I am a string from Swift"
    return swiftString.toFREObject()

    A thorough walkthrough video is available on Youtube

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">