Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename swift package name and add comment #4

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/checkout@v4
- name: Build and Test
run: |
xcodebuild test -scheme PowerSyncSwift -destination "platform=iOS Simulator,name=iPhone 15"
xcodebuild test -scheme PowerSync -destination "platform=iOS Simulator,name=iPhone 15"
16 changes: 8 additions & 8 deletions Demo/PowerSyncExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
18F30B2A2CCA4CD900A58917 /* PowerSyncSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 18F30B292CCA4CD900A58917 /* PowerSyncSwift */; };
6A4AD3852B9EE763005CBFD4 /* SupabaseConnector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4AD3842B9EE763005CBFD4 /* SupabaseConnector.swift */; };
6A4AD3892B9EEB21005CBFD4 /* _Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4AD3882B9EEB21005CBFD4 /* _Secrets.swift */; };
6A4AD3902B9EF775005CBFD4 /* ErrorText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4AD38F2B9EF775005CBFD4 /* ErrorText.swift */; };
Expand Down Expand Up @@ -40,6 +39,7 @@
B666587C2C63B88700159A81 /* SwiftUINavigationCore in Frameworks */ = {isa = PBXBuildFile; productRef = B666587B2C63B88700159A81 /* SwiftUINavigationCore */; };
B69F7D862C8EE27400565448 /* AnyCodable in Frameworks */ = {isa = PBXBuildFile; productRef = B69F7D852C8EE27400565448 /* AnyCodable */; };
B6B3698A2C64F4B30033C307 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6B369892C64F4B30033C307 /* Navigation.swift */; };
B6FFD5322D06DA8000EEE60F /* PowerSync in Frameworks */ = {isa = PBXBuildFile; productRef = B6FFD5312D06DA8000EEE60F /* PowerSync */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -116,9 +116,9 @@
B66658772C63B7BB00159A81 /* IdentifiedCollections in Frameworks */,
B69F7D862C8EE27400565448 /* AnyCodable in Frameworks */,
B666587C2C63B88700159A81 /* SwiftUINavigationCore in Frameworks */,
B6FFD5322D06DA8000EEE60F /* PowerSync in Frameworks */,
6A9669022B9EE69500B05DCF /* Supabase in Frameworks */,
6A9669002B9EE4FE00B05DCF /* PostgREST in Frameworks */,
18F30B2A2CCA4CD900A58917 /* PowerSyncSwift in Frameworks */,
6A9668FE2B9EE4FE00B05DCF /* Auth in Frameworks */,
B666587A2C63B88700159A81 /* SwiftUINavigation in Frameworks */,
);
Expand Down Expand Up @@ -481,7 +481,7 @@
B66658792C63B88700159A81 /* SwiftUINavigation */,
B666587B2C63B88700159A81 /* SwiftUINavigationCore */,
B69F7D852C8EE27400565448 /* AnyCodable */,
18F30B292CCA4CD900A58917 /* PowerSyncSwift */,
B6FFD5312D06DA8000EEE60F /* PowerSync */,
);
productName = PowerSyncExample;
productReference = 6A7315842B9854220004CB17 /* PowerSyncExample.app */;
Expand Down Expand Up @@ -832,11 +832,6 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
18F30B292CCA4CD900A58917 /* PowerSyncSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 18F30B282CCA4B3B00A58917 /* XCLocalSwiftPackageReference "../../powersync-swift" */;
productName = PowerSyncSwift;
};
6A9668FD2B9EE4FE00B05DCF /* Auth */ = {
isa = XCSwiftPackageProductDependency;
package = 6A9668FC2B9EE4FE00B05DCF /* XCRemoteSwiftPackageReference "supabase-swift" */;
Expand Down Expand Up @@ -872,6 +867,11 @@
package = B69F7D842C8EE27300565448 /* XCRemoteSwiftPackageReference "AnyCodable" */;
productName = AnyCodable;
};
B6FFD5312D06DA8000EEE60F /* PowerSync */ = {
isa = XCSwiftPackageProductDependency;
package = 18F30B282CCA4B3B00A58917 /* XCLocalSwiftPackageReference "../../powersync-swift" */;
productName = PowerSync;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 6A73157C2B9854220004CB17 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/powersync-ja/powersync-kotlin.git",
"state" : {
"revision" : "b547389faf77d0c79f30887b5d82489ee3f4de4b",
"version" : "1.0.0-BETA9.0"
"revision" : "ebdb9addc0494ad17f964e8c45617715d2ab6725",
"version" : "1.0.0-BETA11.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Demo/PowerSyncExample/PowerSync/Schema.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import PowerSyncSwift
import PowerSync

let LISTS_TABLE = "lists"
let TODOS_TABLE = "todos"
Expand Down
2 changes: 1 addition & 1 deletion Demo/PowerSyncExample/PowerSync/SupabaseConnector.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Auth
import SwiftUI
import Supabase
import PowerSyncSwift
import PowerSync
import AnyCodable

@Observable
Expand Down
2 changes: 1 addition & 1 deletion Demo/PowerSyncExample/PowerSync/SystemManager.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import PowerSyncSwift
import PowerSync

@Observable
class SystemManager {
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/powersync-ja/powersync-kotlin.git",
"state" : {
"revision" : "b547389faf77d0c79f30887b5d82489ee3f4de4b",
"version" : "1.0.0-BETA9.0"
"revision" : "ebdb9addc0494ad17f964e8c45617715d2ab6725",
"version" : "1.0.0-BETA11.0"
}
},
{
Expand Down
12 changes: 6 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
let packageName = "PowerSyncSwift"
let packageName = "PowerSync"

let package = Package(
name: packageName,
Expand All @@ -14,10 +14,10 @@ let package = Package(
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: packageName,
targets: ["PowerSyncSwift"]),
targets: ["PowerSync"]),
],
dependencies: [
.package(url: "https://github.com/powersync-ja/powersync-kotlin.git", exact: "1.0.0-BETA9.0"),
.package(url: "https://github.com/powersync-ja/powersync-kotlin.git", exact: "1.0.0-BETA11.0"),
.package(url: "https://github.com/powersync-ja/powersync-sqlite-core-swift.git", "0.3.1"..<"0.4.0"),
],
targets: [
Expand All @@ -26,12 +26,12 @@ let package = Package(
.target(
name: packageName,
dependencies: [
.product(name: "PowerSync", package: "powersync-kotlin"),
.product(name: "PowerSyncKotlin", package: "powersync-kotlin"),
.product(name: "PowerSyncSQLiteCore", package: "powersync-sqlite-core-swift")
]),
.testTarget(
name: "PowerSyncSwiftTests",
dependencies: ["PowerSyncSwift"]
name: "PowerSyncTests",
dependencies: ["PowerSync"]
),
]
)
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import PowerSync
import PowerSyncKotlin

internal struct KotlinAdapter {
struct Index {
static func toKotlin(_ index: IndexProtocol) -> PowerSync.Index {
PowerSync.Index(
static func toKotlin(_ index: IndexProtocol) -> PowerSyncKotlin.Index {
PowerSyncKotlin.Index(
name: index.name,
columns: index.columns.map { IndexedColumn.toKotlin($0) }
)
}
}

struct IndexedColumn {
static func toKotlin(_ column: IndexedColumnProtocol) -> PowerSync.IndexedColumn {
return PowerSync.IndexedColumn(
static func toKotlin(_ column: IndexedColumnProtocol) -> PowerSyncKotlin.IndexedColumn {
return PowerSyncKotlin.IndexedColumn(
column: column.column,
ascending: column.ascending,
columnDefinition: nil,
Expand All @@ -22,8 +22,8 @@ internal struct KotlinAdapter {
}

struct Table {
static func toKotlin(_ table: TableProtocol) -> PowerSync.Table {
PowerSync.Table(
static func toKotlin(_ table: TableProtocol) -> PowerSyncKotlin.Table {
PowerSyncKotlin.Table(
name: table.name,
columns: table.columns.map {Column.toKotlin($0)},
indexes: table.indexes.map { Index.toKotlin($0) },
Expand All @@ -35,28 +35,28 @@ internal struct KotlinAdapter {
}

struct Column {
static func toKotlin(_ column: any ColumnProtocol) -> PowerSync.Column {
PowerSync.Column(
static func toKotlin(_ column: any ColumnProtocol) -> PowerSyncKotlin.Column {
PowerSyncKotlin.Column(
name: column.name,
type: columnType(from: column.type)
)
}

private static func columnType(from swiftType: ColumnData) -> PowerSync.ColumnType {
private static func columnType(from swiftType: ColumnData) -> PowerSyncKotlin.ColumnType {
switch swiftType {
case .text:
return PowerSync.ColumnType.text
return PowerSyncKotlin.ColumnType.text
case .integer:
return PowerSync.ColumnType.integer
return PowerSyncKotlin.ColumnType.integer
case .real:
return PowerSync.ColumnType.real
return PowerSyncKotlin.ColumnType.real
}
}
}

struct Schema {
static func toKotlin(_ schema: SchemaProtocol) -> PowerSync.Schema {
PowerSync.Schema(
static func toKotlin(_ schema: SchemaProtocol) -> PowerSyncKotlin.Schema {
PowerSyncKotlin.Schema(
tables: schema.tables.map { Table.toKotlin($0) }
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation
import PowerSync
import PowerSyncKotlin

final class KotlinPowerSyncDatabaseImpl: PowerSyncDatabaseProtocol {
private let kotlinDatabase: PowerSync.PowerSyncDatabase
private let kotlinDatabase: PowerSyncKotlin.PowerSyncDatabase

var currentStatus: SyncStatus {
get { kotlinDatabase.currentStatus }
Expand All @@ -12,7 +12,7 @@ final class KotlinPowerSyncDatabaseImpl: PowerSyncDatabaseProtocol {
schema: Schema,
dbFilename: String
) {
let factory = PowerSync.DatabaseDriverFactory()
let factory = PowerSyncKotlin.DatabaseDriverFactory()
self.kotlinDatabase = PowerSyncDatabase(
factory: factory,
schema: KotlinAdapter.Schema.toKotlin(schema),
Expand Down
12 changes: 12 additions & 0 deletions Sources/PowerSync/Kotlin/KotlinTypes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import PowerSyncKotlin

public typealias KotlinPowerSyncBackendConnector = PowerSyncKotlin.PowerSyncBackendConnector
public typealias CrudEntry = PowerSyncKotlin.CrudEntry
public typealias CrudBatch = PowerSyncKotlin.CrudBatch
public typealias SyncStatus = PowerSyncKotlin.SyncStatus
public typealias SqlCursor = PowerSyncKotlin.RuntimeSqlCursor
public typealias JsonParam = PowerSyncKotlin.JsonParam
public typealias CrudTransaction = PowerSyncKotlin.CrudTransaction
public typealias KotlinPowerSyncCredentials = PowerSyncKotlin.PowerSyncCredentials
public typealias KotlinPowerSyncDatabase = PowerSyncKotlin.PowerSyncDatabase

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Foundation
import Combine
import PowerSync
import PowerSyncKotlin

public protocol Queries {
/// Execute a write query (INSERT, UPDATE, DELETE)
/// Using `RETURNING *` will result in an error.
func execute(sql: String, parameters: [Any]?) async throws -> Int64

/// Execute a read-only (SELECT) query and return a single result.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import PowerSync
import PowerSyncKotlin

public protocol ColumnProtocol: Equatable {
var name: String { get }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import PowerSync
import PowerSyncKotlin

public protocol IndexProtocol {
var name: String { get }
Expand Down
12 changes: 0 additions & 12 deletions Sources/PowerSyncSwift/Kotlin/KotlinTypes.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
private var database: KotlinPowerSyncDatabaseImpl!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class ColumnTests: XCTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class IndexTests: XCTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class IndexedColumnTests: XCTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class SchemaTests: XCTestCase {
private func makeValidTable(name: String) -> Table {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import PowerSyncSwift
@testable import PowerSync

final class TableTests: XCTestCase {

Expand Down