ACEViewSwift
Use the wonderful ACE editor in your Swift Cocoa applications.
For great justice.
Documentation
Most of the APIs are already properly documented and available through Xcode’s quick documentation, but a proper documentation is coming soon :)
Usage
- Clone the repo
- Run
git submodule update --init --recursive
(for the dependencies) - Build the framework target
- Add it into your Swift project
import ACEViewSwift
into your files in order to use it
Note: A pod will be released soon to simplify installation
Make sure you’ve got an IBOutlet in your view controller, and bind that bad girl:
Now, you could do something like this:
import Cocoa
import ACEViewSwift
class ViewController: NSViewController {
@IBOutlet weak var aceView: ACEView!
override func viewDidLoad() {
super.viewDidLoad()
// Some text content
let html = "..."
// onReady() is a convenience closure for configuring
// the ACEView right after it has been finished loading
aceView.onReady = { [unowned self] in
self.aceView.string = html
self.aceView.mode = .HTML
self.aceView.theme = .Xcode
self.aceView.keyboardHandler = .Ace
self.aceView.showPrintMargin = true
self.aceView.showInvisibles = false
self.aceView.basicAutoCompletion = true
self.aceView.liveAutocompletion = true
self.aceView.snippets = true
self.aceView.emmet = true
self.aceView.focus()
}
}
}
Contributions
All are welcome, all are read.
Many thanks to Michael Robinson and all the people that developed the original ObjC framework !