Add meta-sqlite to adwaita-swift
This commit is contained in:
parent
34f5b46d60
commit
0a6f1043b9
@ -24,6 +24,7 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/AparokshaUI/Meta", branch: "main"),
|
.package(url: "https://github.com/AparokshaUI/Meta", branch: "main"),
|
||||||
|
.package(url: "https://github.com/AparokshaUI/meta-sqlite", branch: "main"),
|
||||||
.package(
|
.package(
|
||||||
url: "https://github.com/david-swift/LevenshteinTransformations",
|
url: "https://github.com/david-swift/LevenshteinTransformations",
|
||||||
from: "0.1.1"
|
from: "0.1.1"
|
||||||
@ -40,7 +41,8 @@ let package = Package(
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
"CAdw",
|
"CAdw",
|
||||||
.product(name: "LevenshteinTransformations", package: "LevenshteinTransformations"),
|
.product(name: "LevenshteinTransformations", package: "LevenshteinTransformations"),
|
||||||
.product(name: "Meta", package: "Meta")
|
.product(name: "Meta", package: "Meta"),
|
||||||
|
.product(name: "MetaSQLite", package: "meta-sqlite")
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
.executableTarget(
|
.executableTarget(
|
||||||
|
|||||||
@ -6,7 +6,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import CAdw
|
import CAdw
|
||||||
|
import Foundation
|
||||||
@_exported import Meta
|
@_exported import Meta
|
||||||
|
@_exported import MetaSQLite
|
||||||
|
|
||||||
/// The Meta app storage for the Adwaita backend.
|
/// The Meta app storage for the Adwaita backend.
|
||||||
public class AdwaitaApp: AppStorage {
|
public class AdwaitaApp: AppStorage {
|
||||||
@ -31,6 +33,7 @@ public class AdwaitaApp: AppStorage {
|
|||||||
/// - Parameter id: The identifier.
|
/// - Parameter id: The identifier.
|
||||||
public required init(id: String) {
|
public required init(id: String) {
|
||||||
pointer = adw_application_new(id, G_APPLICATION_DEFAULT_FLAGS)?.cast()
|
pointer = adw_application_new(id, G_APPLICATION_DEFAULT_FLAGS)?.cast()
|
||||||
|
DatabaseInformation.setPath(Self.userDataDir().appendingPathComponent("data.sqlite").path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Copy a string to the clipboard.
|
/// Copy a string to the clipboard.
|
||||||
@ -39,6 +42,12 @@ public class AdwaitaApp: AppStorage {
|
|||||||
gdk_clipboard_set_text(clipboard, text)
|
gdk_clipboard_set_text(clipboard, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The directory used for storing user data.
|
||||||
|
/// - Returns: The URL.
|
||||||
|
public static func userDataDir() -> URL {
|
||||||
|
.init(fileURLWithPath: .init(cString: g_get_user_data_dir()))
|
||||||
|
}
|
||||||
|
|
||||||
/// Execute the app.
|
/// Execute the app.
|
||||||
/// - Parameter setup: Set the scene elements up.
|
/// - Parameter setup: Set the scene elements up.
|
||||||
public func run(setup: @escaping () -> Void) {
|
public func run(setup: @escaping () -> Void) {
|
||||||
|
|||||||
@ -11,7 +11,8 @@ import Adwaita
|
|||||||
|
|
||||||
struct CounterDemo: View {
|
struct CounterDemo: View {
|
||||||
|
|
||||||
@State private var count = 0
|
@State("count")
|
||||||
|
private var count = 0
|
||||||
|
|
||||||
var view: Body {
|
var view: Body {
|
||||||
VStack {
|
VStack {
|
||||||
|
|||||||
@ -68,7 +68,8 @@ struct Demo: App {
|
|||||||
|
|
||||||
struct DemoContent: WindowView {
|
struct DemoContent: WindowView {
|
||||||
|
|
||||||
@State private var selection: Page = .welcome
|
@State("selection")
|
||||||
|
private var selection: Page = .welcome
|
||||||
@State private var toast: Signal = .init()
|
@State private var toast: Signal = .init()
|
||||||
@State private var sidebarVisible = true
|
@State private var sidebarVisible = true
|
||||||
@State private var width = 650
|
@State private var width = 650
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user