All Projects → TomasLinhart → Swiftgtk

TomasLinhart / Swiftgtk

Licence: mit
SwiftGtk is an experimental Gtk+ binding for Swift that tries to make usage of Gtk+ pleasant and "Swifty" as much as possible.

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Swiftgtk

Playhouse
A Playground for HTML/CSS/JavaScript
Stars: ✭ 28 (-90.73%)
Mutual labels:  gtk
rnote
A simple drawing application to create handwritten notes.
Stars: ✭ 1,538 (+409.27%)
Mutual labels:  gtk
Stoq
Stoq Retail Management System
Stars: ✭ 269 (-10.93%)
Mutual labels:  gtk
principles
Remember Dieter Rams' ten principles of good design on elementary OS
Stars: ✭ 38 (-87.42%)
Mutual labels:  gtk
buzztrax
Buzztrax is a modular music composer for Linux.
Stars: ✭ 86 (-71.52%)
Mutual labels:  gtk
Tray
Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu.
Stars: ✭ 262 (-13.25%)
Mutual labels:  gtk
switchboard-plug-bluetooth
Switchboard Bluetooth Plug
Stars: ✭ 23 (-92.38%)
Mutual labels:  gtk
Terminal
Terminal emulator designed for elementary OS
Stars: ✭ 281 (-6.95%)
Mutual labels:  gtk
quick-lookup
Simple GTK dictionary application powered by Wiktionary
Stars: ✭ 57 (-81.13%)
Mutual labels:  gtk
Exaile
🎶 Cross-platform music player
Stars: ✭ 270 (-10.6%)
Mutual labels:  gtk
lightdm-gtk-greeter
A GTK greeter for LightDM
Stars: ✭ 63 (-79.14%)
Mutual labels:  gtk
wingpanel-indicator-network
Wingpanel Network Indicator
Stars: ✭ 22 (-92.72%)
Mutual labels:  gtk
Termonad
Terminal emulator configurable in Haskell.
Stars: ✭ 266 (-11.92%)
Mutual labels:  gtk
scalaui
Scala Native GUI framework based on libui
Stars: ✭ 56 (-81.46%)
Mutual labels:  gtk
Apostrophe
Mirror of
Stars: ✭ 272 (-9.93%)
Mutual labels:  gtk
nicotine-plus
Graphical client for the Soulseek peer-to-peer network
Stars: ✭ 601 (+99.01%)
Mutual labels:  gtk
Stylesheet
The GTK Stylesheet for elementary OS
Stars: ✭ 260 (-13.91%)
Mutual labels:  gtk
Node Gtk
GTK+ bindings for NodeJS (via GObject introspection)
Stars: ✭ 287 (-4.97%)
Mutual labels:  gtk
Eiskaltdcpp
File sharing program using DC and ADC protocols
Stars: ✭ 277 (-8.28%)
Mutual labels:  gtk
Razer Laptop Control
Project to create driver/software to control performance of razer laptops
Stars: ✭ 268 (-11.26%)
Mutual labels:  gtk

SwiftGtk

SwiftGtk is a experimental Gtk+ binding for Swift that tries to make usage of Gtk+ pleasant and "Swifty" as much as possible. Currently it implements only a small subset of Gtk+ and it works on Mac OS X and Linux.

Dependencies

You need to have Swift 3.1 or higher installed on your computer (tested with 3.1.1 bundled with Xcode 8.3.3) and depending on your platform you need to install Gtk+3. On Mac OS X you can also build the project with Xcode.

Mac OS X

You need to have Gtk+3 installed on your machine. Recommended way for installing Gtk+3 is through homebrew.

brew install gtk+3

Linux

You need to have Gtk+3 and Clang installed on your machine. You can easily install them with apt-get.

sudo apt-get install libgtk-3-dev clang

Usage

SwiftGtk supports Swift Package Manager so you only need to add SwiftGtk to your Package.swift.

import PackageDescription

let package = Package(
    name: "SwiftGtkApplication",
    dependencies: [
        .Package(url: "https://github.com/TomasLinhart/SwiftGtk", Version(0, 3, 1))
    ]
)

After that run swift build in the folder where Package.swift is located. Once it builds you can execute the application .build/debug/SwiftGtkApplication.

Demo

Following code will create a window with a button that when it is pressed presents another window.

import SwiftGtk

let app = Application(applicationId: "com.example.application")
app.run { window in
    window.title = "Hello World"
    window.defaultSize = Size(width: 400, height: 400)
    window.resizable = true

    let button = Button(label: "Press Me")
    button.clicked = { _ in
        let newWindow = Window(windowType: .topLevel)
        newWindow.title = "Just a window"
        newWindow.defaultSize = Size(width: 200, height: 200)
        let labelPressed = Label(text: "Oh, you pressed the button.")
        newWindow.add(labelPressed)

        newWindow.showAll()
    }

    window.add(button)
}

License

All code is licensed under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].