Repository navigation
Creating AliceKit Apps
This article will help you create a sample AliceKit app and go over the basic structure of an AliceKit app. This assumes that you have followed all previous tutorials to install AliceKit.
AliceKit simplifies the process of creating apps using Swift packages. These packages rely on Qlift, the API responsible for binding Qt and Swift together. The Swift package generally follows this structure:
Sources/
/ Main.swift
/ MainWindowController.swift
Package.swift
The Package.swift file is what calls and pulls Qlift from the system for development. It lists the required packages and also names the package. More information about Package.swift can be found on the guide for Swift Package Manager.
The main code for where the program will run, in addition to other logical code, is located in Main.swift. It usually includes this important information:
//The primary function to open the window
func main() -> Int32 {
// Create a Qt application and MainWindow object
print("Running AliceKit and looking for Qt...")
let application = QApplication()
let mainWindow = SwiftMachine()
//Show the contents of MainWindow
print("Qt found and running. Turning on Swift Machine...")
mainWindow.show()
print("Done. Presenting content...")
return application.exec()
print("Ready for action.")
}Finally, you have UI files like MainWindowController.swift, which are responsible for making user interfaces in Swift. Qlift offers support for using Qt Creator to design the interface, but we recommend programmatically creating them. These files are responsible for creating the window and displaying its contents, which is referred to in main.swift.
The easiest way to create an AliceKit app is to clone the AliceKit demo, Lorem. It already places the code and follows the AliceKit style guide, letting you place in the code and focus on your content.
- Start by running
git clone https://www.github.com/artemis-project/alicekit-lorem/into the terminal. This will pull the source code for you. - Edit the files as needed and create your app.
- When you are ready to debug and test, you can run the AliceKit Debugger (
./akdebug.sh) to build and run the app; however, be sure to replace 'lorem' with your package name in the file before running it. This will make sure you're running the package and not the one that won't exist.
Note: For security reasons, AliceKit Debugger will not run on your system. To fix the issue, run
chmod +x akdebug.sh.
Previously: ‹ Install Qlift Systemwide
Recommended: AliceKit Style Guide
AliceKit (C) 2017 Artemis Project team Licensed under GNU GPL v3

AliceKit currently works on Swift 3.1.1 and uses Qlift (and API) 0.0.37.