A CodeFlow blog

about live coding and more…

CodeFlow turns 1.0


It has been some time since the last beta of CodeFlow, version 0.9.20 was released in January this year. And all this time, we have worked very hard to improve CodeFlow, and to turn it into an effective Application Development System that we love to use in our daily work.

We have – literally – fixed hundreds of bugs. We have added awesome new features and and brought significant improvements to almost every aspects of the system. And, to be honest, all this has taken slightly longer than expected. But it was worth the wait.

And Today, I am very happy to announce that CodeFlow 1.0 is available for download! 🚀 😃 🎉

Note that, even if the version number has jumped to 1.0, we consider the CodeFlow beta phase as still ongoing. Which means in particular that you can still use CodeFlow for free for a while, so really you should have no reason for not downloading this 1.0 version… 😉

Before jumping into new features of this version, let's start with a quick recap of what CodeFlow is and what it does.

What is CodeFlow?

CodeFlow is a Live Application Development Environment for iOS, tvOS and macOS.

Lua language

CodeFlow use the Lua programming language for Live Application development. Lua is a nice, fast, easy-to-learn and powerful language.

And if you are not yet familiar with Lua, a good way to start is to read our Get Started with Lua tutorials.

Native APIs

With CodeFlow, you create native applications, that use native OS APIs, and run their native UI at native speed.

This is made possible by a key component of CodeFlow: the native bridge. In short, CodeFlow native bridge makes the OS SDK available to the Lua code in your app. Meaning that anything you can do in Objective-C or Swift, you can do it in Lua with CodeFlow. And there is more: the native bridge extends to your own custom code in the App Xcode project, so you can easily write hybrid applications, partly written using traditional Objective-C or Swift code, and partly written in Lua, with both parts capable of working closely together.

To learn more about the native bridge, read Get Started with Lua - CodeFlow Native Bridge.

IDE

CodeFlow comes as an IDE, running on macOS. The CodeFlow IDE includes a nice dedicated Lua code editor and a powerful, always-available Lua debugger.

The Lua editor includes features like advanced syntax coloring, code indentation, syntax error detection, variables scoping, or automatic code completion (including native methods or property names from the OS SDK).

The Lua debugger supports breakpoints, step-by-step execution, and stop-on-error. It has a nice stack & variables inspector, that shows the contents of Lua local and global variables, capable of presenting useful information for both Lua and native values/objects. It supports multithreaded execution and shows all active Lua threads in the program at any given time. Finally, the Lua debugger includes a context-aware Lua command console, in which you can execute arbitrary code in the context of the selected Lua thread/stack-frame.

A codeFlow project can include Lua code files, as well as (non-code) resources (e.g. images). CodeFlow includes a QuickLook-base resource viewer, and delegates resource editing to appropriate external resource editor applications. And CodeFlow also supports resource update by drag-and-drop.

Live App Development

Live Application Development is a more-natural more-interactive way of developing applications. Where old-style App development considers code-writing and app-running as two separate steps in the development cycle, Live Application Development gives you the freedom to code your application while it is running. Seeing the results of source code edits immediately in the real application, without having to re-build, re-load and re-run it, is incredibly fun and powerful, especially when creating the app's user interface, or for fixing bugs.

As a Live App Development Environment, CodeFlow is designed to provide instant feedback to the developer, by updating the running application in real-time when its source code is changed.

For this, CodeFlow implements two features. The first is automatic device connection: Devices in the network that run an application embedding the CodeFlow library are automatically detected by CodeFlow and can be used as targets by a corresponding CodeFlow project.

The second feature is live application update: When connected to a target application, CodeFlow keeps this application in sync with the current project, updating Lua source code and resources in the app when necessary, and without stopping it.

Live App Development is not limited to a single device: you can connect multiple devices to a same CodeFlow project, with different screen sizes or different OS versions, and do live update on all of them simultaneously!

Local Lua Context

A Local Lua Context is a special kind of lightweight target for a CodeFlow project, that executes the project's Lua code inside the CodeFlow IDE. Local Lua Contexts are useful as playgrounds, when you just want to test some code without creating an application for that. Local Lua Contexts have access to a limited set of macOS frameworks and they benefit from the same debug facilities as real target applications.

New Features in CodeFlow 1.0

CodeFlow 1.0 includes quite a lot or new or improved features, and enumerating them all would make this post too long and boring.

This section will highlight a few important new features in CodeFlow 1.0. Other improvements will be listed in the next section Other Changes in CodeFlow.

Project templates

Project templates in CodeFlow are similar to templates in other IDEs: they create pre-packaged projects that you can use as a starting point for your own app. Using a project template saves you lots of time and effort, as you don't have write boilerplate code or project setup before launching the target application for the first time. In CodeFlow, templates are particularly important for two more reasons:

  1. CodeFlow is a Live Application Development Environment, so things have to be responsive and fast, particularly when starting a new project;
  2. CodeFlow targets iOS, tvOS and macOS, so a CodeFlow project is not enough to build an application: an Xcode project is needed too. And this brings additional complexity to the project setup.

This is why project templates was certainly the most awaited feature in CodeFlow. With CodeFlow 1.0, the wait is now over, and project templates turn live app creation into a very simple operation.

When you create a new project in CodeFlow (File->New Project… or ⌘N), the New Project Window is diplayed and shows a list of available templates. Select a template in the list, configure a few fields (or leave them with the default values), select a directory for the new project and you are done.

New Project Window

Actually a CodeFlow template creates two projects: a CodeFlow project and an Xcode project, associated with the CodeFlow project and configured accordingly. Therefore, as soon as CodeFlow completes the project configuration , you can open the Xcode project from CodeFlow (Program->Open Xcode Project or ⇧⌘O), run the application on a device or in the simulator, and start live-coding right away.

CodeFlow 1.0 includes 9 generic application templates: 5 for iOS, 2 for tvOS, and 2 for macOS. All of them have a Swift/Objective-C option for the associated Xcode project. And all of them, except the Empty iOS Application template, support live storyboard updates (see below).

In addition, CodeFlow 1.0 comes with a few Example Application templates. Examples Applications are provided as templates, so that you can play with the code at will, and if you break things up, you can simply create a new project and continue experimenting with it.

Live storyboard update

Storyboards play an important role in iOS app development, and CodeFlow could not pretend to enable Live App Development for iOS without supporting seamless storyboards updates in target applications.

So live storyboard update is available in CodeFlow 1.0. And this is a good thing, because actually seeing the user interface take shape interactively in the real application, when adding interface components and setting layout constraints in Xcode, is an incredibly cool experience!

I wrote an entire blog post about Live storyboards in April, so please read it if you want to know more about this feature. Or watch this short "Hello World" video (from the same blog post) which gives a pretty good idea of live storyboards in action.

Under the hood, the magic of live storyboard updates comes from a Lua module present in every project template (for storyboard-based apps). This module, called MonitorViewControllerClass in iOS projects and MonitorControllerClass in macOS projects, is available in source code, so feel free to customize it for your own needs if necessary.

Swift support

CodeFlow 1.0 adds support for Swift. This means that the CodeFlow library can be integrated in an application written in Swift, and also that classes, methods, and object properties defined in Swift can be exposed to the Lua code in CodeFlow.

All generic application templates in CodeFlow have an option to create a Swift Xcode project. You can use these templates as examples of how to use CodeFlow's CIMLua interface in Swift.

Concerning the visibility in Lua of class, methods or properties defined in Swift, the rule is simple: Swift class, methods or properties that are visible from Objective-C, are visible from Lua.
For more information about this, see Apple document Using Swift with Cocoa and Objective-C.

That being said, there is no real difference, seen from Lua code, between native interfaces exposed by Swift and native interfaces exposed by Objective-C. It just works.

Lua Runtime improvements

The Lua Runtime is the CodeFlow library that powers live code execution and update in target applications. In CodeFlow 1.0, the Lua runtime includes lots of internal improvements, and it gains noteworthy new features:

  • Lua object properties are now compatible with KVC and KVO (Key Value Coding / Observing), so you can implement a property in Lua, and have native code of your application notified when it change. And you can use Cocoa bindings on macOS, to display a Lua property in your target application without writing a single line of code.
  • You can now call the original implementation of a native method, even when a Lua method overrides it. You do this by indexing the target object by the objc global variable, like this self[objc]:viewDidLoad(). You generally use this feature to extend in Lua a method already implemented natively by the current class; you can also use it as an easy and reasonnably-safe way of doing dynamic method swizzling!
  • You can now use weak references to native objects in your Lua code. Weak object references are useful to avoid creating retain cycles involving one or more native objects. CodeFlow 1.0 add two generic Lua object properties weakRef and strongRef for controlling the memory lifecycle of native objects. anObject.weakRef gets a weak reference on anObject, that you can use in your Lua code or store in a variable without preventing the deallocation of the referenced object. On the other hand, yo use strongRef to get a back strong object reference from a weak reference; if the object does not exist anymore, strongRef returns nil. Note that a Lua object property can also be defined as "weak".

Other changes in CodeFlow 1.0

This section lists other significant improvements brought by CodeFlow 1.0.

Lua Source Editor

  • Code-completion now include methods and properties declared in Objective-C protocols referenced by the current Lua source file.
  • Code-completion of native bridge globals, like objc or struct, are now proposed even if the global has been aliased to a local variable. For example: Code-completion still works for fields of aliased global variables
  • Type comment annotation, like --[[@type objc.UICollectionViewLayout]] are now taken into account when proposing code completions in the current Lua file.
  • Improved 'Dependencies' menu in source editor bar, that displays the full hierarchy of classes, protocols and structs referenced in the current Lua file. In addition, selecting a class, class category, protocol or struct in this menu jumps to the corresponding declaration in the relevant bindings file and highlights it.
  • Pasting or uncommenting code now correctly re-indent the corresponding code range.

CodeFlow Project & Files List

  • Added a New Empty Project command in the File menu, that creates an empty project with a Local Lua Context.
  • Added support for package-typed resources in a CodeFlow project. This means that you can add a resource of any type to a CodeFlow project and process this resource in the Lua code of your target application.
  • Drag & drop: You can now control how dropped files in the project files list shall behave by using standard modifier keys: use ⌥⌘ to link the resource item to the dragged file, to create an internal copy of the dragged file, or to replace the content of a resource without replacing the existing link. You can also set the default behavior (link or copy) in the CodeFlow preferences.
  • Drag & drop: You can now replace the content of a resource with a file having a compatible content type. For example, you can drop a png file on a resource with a jpeg image content, and see the connected target applications being updated with the new image.
  • A group in a CodeFlow project can now be linked to a directory in the file system. Linking a group means that any change you make to this group in CodeFlow will be reflected in the linked directory (adding or removing a Lua source file or resource, editing a Lua file…). And any change in the linked directory will be immediately visible in the group in CodeFlow. In addition, changes done to a linked group, in CodeFlow or by modifying the linked directory, can now be undone.
    Linked groups in CodeFlow can be used to share Lua code between projects, or to organize Lua code and resources into git repositories/submodules (or equivalent configuration management units for your favorite tool).

Code Execution and Debug

  • Projects can now automatically connect to target applications with specific service name patterns. When you create a CodeFlow project from a template, the auto-connect pattern is automatically set for you, based on the new project's Product-Name and Lua-Context-Name, so generally you don't have to set this manually.
    Automatic connection to targets is configured in the Targets popover
  • The initial breakpoint on a starting target Lua Context can now be enabled / disabled on a per-project basis.
  • Lua module reloading does not interrupt you anymore when you are typing code in Lua module with autoload enabled!
  • Continuing execution after stopping in an old code module version, now switches back the code editor to the last edited file.
  • Added keyboard shortcuts and menu commands for debug actions.
  • In Local Lua Contexts, you can now use the debug commands to run a Lua source file, when the Lua Context is idle.
  • Added a Restart Local Lua Context command in the Execution menu.
  • Switching the debug interface to a given connected targets is now possible via the execution menu, or with keyboard shortcuts ⌘1, ⌘2
  • The variable inspector now updates global variables in real time while your application is running (even if it does not stop on a breakpoint).

Lua Code and Bindings

  • The new property() Lua function is the new way of declaring object properties in Lua classes. Properties declared using this syntax (see in Get Started with Lua - CodeFlow object Framework) are flexible and compatible with Objective-C properties and Swift computed properties.
  • Added Lua object introspection methods implementsLuaMethod and implementsLuaClassMethod.
  • More flexible Message/Resource handler parameters. For example, a handler function passed to a Message- or Resource-Handler can now omit the self parameter if not useful.
  • Resource handlers now have an extra resource file URL passed as their last parameter. This allows a resource handler to use the raw resource data if more convenient than using the proposed resource object.
  • Binding Lua files now have a type annotation for block parameters that indicates the expected function prototype. Example:

    function NSString:enumerateSubstringsInRange_options_usingBlock 
                    (range --[[@type struct.NSRange]], 
                     opts --[[@type enum(NSStringEnumerationOptions)]], 
                     block --[[@type function(substring, substringRange, enclosingRange)->stop]])  
        --[[@return nil]] 
    end
    
  • Binding Lua files now indicate required and optional methods of protocols
  • Binding Lua files now declare properties using the new property notation. Example:

    UIView.userInteractionEnabled --[[@type bool]] = property { get = 'isUserInteractionEnabled' }
    UIView.tag --[[@type integer]] = property()
    UIView.layer --[[@type objc.CALayer]] = property { kind = 'readonly' }
    UIView.focused --[[@type bool]] = property { kind = 'readonly', get = 'isFocused' }
    
  • Local Lua Contexts now have an associated SDK Bindings library that shows available frameworks and APIs.
    SDK Bindings Library for Local Lua Contexts show available frameworks

CodeFlow Objective-C/Swift API

  • Added method -doLuaSetupIfNeeded that you call on instances of a native class with a Lua extension, if some Lua-specific setup must be done on these instances. For example, if you load a Lua module that extends the class of the root view controller, you can write:

    [_luaContext loadLuaModuleNamed:@"ViewController" withCompletionBlock:^(id result) {
        if (result != nil) {
            // Configure the rootViewController in Lua
            [(id<CIMLuaObject>)self.window.rootViewController doLuaSetupIfNeeded];
        }
    }];
    

    or in Swift:

    luaContext?.loadLuaModuleNamed("ViewController", withCompletionBlock: { (result) in
            // Configure the rootViewController in Lua
            (self.window?.rootViewController as! CIMLuaObject).doLuaSetupIfNeeded()
        })
    
  • Added method -isLuaClassExtensionLoadedForClass: and -isLuaClassExtensionLoadedForClass:withId: to test if a given Lua class extension is loaded.
  • Improved kCIMLuaModuleLoadedNotification, that now contains extensive information about the loaded module and its results. In addition, this notification is now sent for every loaded module (previously it was only sent for Lua modules loaded from the CIMLua API).
  • On iOS, your app can now display a modal dialog while trying to connect to the IDE. Pressing the 'Skip' button in this dialog make the app switch to the embedded Lua code and resource cache.
  • Added nullability annotations in CIMLua.h, for a better coding experience in Swift.
    Note that these nullability annotations make CIMLua.h incompatible with Xcode 6.2 and earlier. If this is a problem for you, drop us a line (by email or using the feedback forms in CodeFlow) and we will manage to find a compatible solution very quickly.

Xcode Project Management

  • Better accuracy of the list of frameworks and libraries that need to be linked with the target application.
  • Project bindings generation now gently asks Xcode to write unsaved files to disk, in the associated Xcode project, before checking if a Bindings Library update is needed.
  • After changing the Xcode project, changed methods and properties are available much quicker for code-completion in CodeFlow Lua editor, or for dynamic declaration in the target application.
  • CodeFlow now enforce the consistency between the target platform defined in the associated Xcode project and the SDK Bindings library selected in a CodeFlow project.

Misc.

  • New application icon.
    CodeFlow new icon
  • You can now send feedback or submit bugs without leaving CodeFlow. Select Send Feedback… or Report a Bug… in the Help menu, and write your feedback in the provided rich-text editor. You can paste code from CodeFlow or Xcode (it will keeps its colors), you can add images, or attachments of any kind. You are free. The sole constraint is the size: feedback messages are limited to 64 MB each, so no big movie, but everything else should fit in.
    Use the new feedback forms to report a bug or to send general feedback
  • Updated user license agreement.
  • Updated internally the Sparkle framework to version 1.14.0 (For information, CodeFlow use https for updates, and was therefore not vulnerable to the security issue fixed by this version, but it is always good to stick to a recent version :-).
  • CodeFlow now include bindings libraries for the SDKs available in 7.3.1 (iOS 9.3, tvOS 9.2, macOS 10.11.4).

Code different : Think live.

All these new features and improvements make CodeFlow 1.0 a great App Development System. And the Live Development feature makes CodeFlow truly unique in the world of iOS coding tools.

You can download CodeFlow 1.0 from the downloads page here.

And we'd love to hear from you. Use the new feedback forms in CodeFlow's Help menu, and tell us how you use CodeFlow, what you like in it, what we should improve, what feature you want too see in future CodeFlow versions…

And, most of all, we hope that you will enjoy the freedom and creativity enabled by live coding!

Post a Comment


Recent posts

Blog Post
Aug 1, 2016

CodeFlow 1.0.2

CodeFlow 1.0.2 is a minor release that focuses on improving the Live Application Developer's Experience.

Aug 1, 2016
Blog Post
Jun 16, 2016

CodeFlow 1.0.1 and WWDC 2016

The just-released CodeFlow 1.0.1 brings support for the new iOS 10, tvOS 10 and macOS 10.12 announced at WWDC 2016 this week.

Jun 16, 2016
Blog Post
Jun 9, 2016

CodeFlow turns 1.0

It has been some time since the last beta of CodeFlow, version 0.9.20 was released in January this year. And all this time, we have worked very hard to improve CodeFlow, and to turn it into an effective Application Development System that we love to…

Jun 9, 2016

Last tweets

Dec 7, 2017
🛠New CodeFlow SDK Bindings are available for all supported Xcode versions: 9.2, 8.3, and 7.3. 😊
celedev.com/en/download/
Dec 7, 2017
Aug 9, 2017
🛠CodeFlow SDK Bindings for Xcode 9 beta 5 are available for download. Enjoy! 😊
celedev.com/en/download/
Aug 9, 2017
Jul 11, 2017
New APIs in Xcode 9 / iOS 11 beta 3? CodeFlow supports them from day 1. 😀
🛠 Download updated OS SDK bindings from celedev.com/en/download/
Jul 11, 2017
Jul 2, 2017
CodeFlow 1.1.1 is out, and supports real-time native app development for iOS 11 and macOS 10.13.
Check for update or celedev.com/en/download/
Jul 2, 2017
Dec 5, 2016
@JLJumpertz
"Programming iOS in Lua - A bridge story"
Slides of my talk at Lua Workshop 2016 are here: slideshare.net/jljumpertz/pro…
#lualang #iosdev
Dec 5, 2016
Oct 11, 2016
Little Lua red Panda is now on GitHub! github.com/celedev/LuaPan…
A SceneKit 3D game in #LuaLang with dynamic update of all 3D assets and code
Oct 11, 2016
Oct 3, 2016
CodeFlow 1.0.3 is out!
⚡️ Live SceneKit assets, Sierra support, and more…
celedev.com/en/download/#c…
#lualang #iosdev
Oct 3, 2016
Oct 1, 2016
@aligatr
@Javi @nicklockwood same and also sad they didn't mention Redux realm.io/news/benji-enc… nor @celedev for Live Reloading & Faster iterations
Oct 1, 2016
Sep 22, 2016
If you want to test in #LuaLang the (few) new APIs added in iOS 10.1, CodeFlow SDK Bindings for Xcode 8.1 are there
celedev.com/en/download/#s…
Sep 22, 2016
Sep 20, 2016
Live update of SceneKit assets will be available very soon in a new CodeFlow version (1.0.3). Stay tuned! 😊
Sep 20, 2016
Sep 20, 2016
@JLJumpertz
🎉 Live feedback of SceneKit assets in a running app with @celedev!
1. texture
2. scene editing
3. animation
Sep 20, 2016
Sep 8, 2016
Ready for shipping your app for iOS 10, tvOS 10 or macOS 10.12?
Our #LuaLang live-code SDK Bindings are ready too 😎
celedev.com/en/download/#s…
Sep 8, 2016
Sep 6, 2016
@JLJumpertz
Next step, add live SceneKit resources: when using Xcode's SceneKit editor, send the updated assets dynamically to the live application.
Sep 6, 2016
Sep 6, 2016
@JLJumpertz
Amazing how easier SceneKit becomes when using live application update, thks to instant feedback of 3D math! 😃
Sep 6, 2016
Aug 4, 2016
Minor update for CodeFlow 1.0.2 today, fixing a rare issue in dynamic resource updates.
Check for updates or celedev.com/en/download/#c…
Aug 4, 2016