XUtils

swift-mode

Emacs support, including partial flycheck error support.


Features

  • Font Lock
  • Indentation
  switch foo {
  case let .P1(x)
         where
           x > 0,
       let .P2(x)
         where
           x > 0:
      bar()
        .then { x in
            return baz(x)
        }
        .then {(
                 x,
                 y
               ) in
            return moo(x + y)
        }
  }

  // Hanging brace
  let x = [
    1,
    2,
    3
  ]

  // Brace on its own line
  let y =
    [
      1,
      2,
      3
    ]

  // Utrecht style
  let z =
    [ 1
    , 2
    , 3
    ]
  • forward-sexp
  • beginning-of-defun, end-of-defun, mark-defun, and narrow-to-defun.
  • beginning-of-sentence, end-of-sentence, kill-sentence, backward-kill-sentence, mark-sentence, and narrow-to-sentence. A sentence is a statement outside comments or strings, or an ordinal sentence inside comments or strings.
  • indent-new-comment-line
  • Imenu
  • Running Swift REPL in a buffer (M-x run-swift)
  • Build Swift module (M-x swift-mode:build-swift-module)
  • Build iOS app (M-x swift-mode:build-ios-app)
  • Running debugger on Swift module (M-x swift-mode:debug-swift-module)
  • Running debugger on iOS app in simulator or device (M-x swift-mode:debug-ios-app) (ios-deploy is required to debug on device).

This package does not provide flycheck. See flycheck-swift.

Hacking

To build the package locally, run make package.

To install the built package, run make install.

To run tests, run make test.

For other commands, run make help.

Acknowledgements

The REPL code is based on js-comint.

Thanks to the following original developer and users for their contributions:

You can find a full list of those people here.

Thanks to @purcell (Steve Purcell) for advices on the code and arrangement for merging swift3-mode and swift-mode.


Articles

  • coming soon...