Skip to content
Open
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
5 changes: 4 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ steps:
queue: android
plugins: *plugins

- label: ':swift: Test Swift Package'
- label: ':swift: Swift Simulator Tests'
command: make test-swift-package
plugins: *plugins

- label: ':swift: Test Swift Logic'
command: swift test
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SIMULATOR_DESTINATION := OS=18.4,name=iPhone 16 Plus
SIMULATOR_DESTINATION := arch=arm64,OS=18.4,name=iPhone 16 Plus

define XCODEBUILD_CMD
@set -o pipefail && \
xcodebuild $(1) \
-scheme GutenbergKit \
-scheme GutenbergKit-Package \
-sdk iphonesimulator \
-destination '${SIMULATOR_DESTINATION}' \
| xcbeautify
Expand Down
25 changes: 21 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,44 @@ let package = Package(
name: "GutenbergKit",
platforms: [.iOS(.v15), .macOS(.v14)],
products: [
.library(name: "GutenbergKit", targets: ["GutenbergKit"])
.library(name: "GutenbergKit", targets: ["GutenbergKit"]),
.library(name: "GutenbergKitAssetManifestParser", targets: ["GutenbergKitAssetManifestParser"])
],
dependencies: [
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.7.5"),
],
targets: [
.target(
name: "GutenbergKit",
dependencies: ["SwiftSoup"],
dependencies: [],
path: "ios/Sources/GutenbergKit",
exclude: [],
resources: [.copy("Gutenberg")]
),
.target(
name: "GutenbergKitAssetManifestParser",
dependencies: ["GutenbergKit", "SwiftSoup"],
path: "ios/Sources/GutenbergKitAssetManifestParser",
exclude: [],
resources: []
),
.testTarget(
name: "GutenbergKitTests",
dependencies: ["GutenbergKit"],
path: "ios/Tests",
path: "ios/Tests/GutenbergKitTests",
exclude: [],
resources: [
.copy("GutenbergKitTests/Resources/manifest-test-case-1.json")
.copy("Resources/manifest-test-case-1.json")
]
),
.testTarget(
name: "GutenbergKitAssetManifestParserTests",
dependencies: ["GutenbergKitAssetManifestParser"],
path: "ios/Tests/GutenbergKitAssetManifestParserTests",
exclude: [],
resources: [
.copy("../GutenbergKitTests/Resources/manifest-test-case-1.json")
]
)
]
)
28 changes: 25 additions & 3 deletions ios/Demo-iOS/Gutenberg.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -13,6 +13,8 @@
0CE8E78E2C339B0600B9DC67 /* GutenbergApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CE8E7872C339B0600B9DC67 /* GutenbergApp.swift */; };
0CE8E78F2C339B0600B9DC67 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CE8E7892C339B0600B9DC67 /* Preview Assets.xcassets */; };
0CF6E04C2BEFF60E00EDEE8A /* GutenbergKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0CF6E04B2BEFF60E00EDEE8A /* GutenbergKit */; };
24CA22122E72516A007E32F8 /* GutenbergKit in Frameworks */ = {isa = PBXBuildFile; productRef = 24CA22112E72516A007E32F8 /* GutenbergKit */; };
24CA22142E72516A007E32F8 /* GutenbergKitAssetManifestParser in Frameworks */ = {isa = PBXBuildFile; productRef = 24CA22132E72516A007E32F8 /* GutenbergKitAssetManifestParser */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -22,7 +24,6 @@
0CE8E7862C339B0600B9DC67 /* EditorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorView.swift; sourceTree = "<group>"; };
0CE8E7872C339B0600B9DC67 /* GutenbergApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GutenbergApp.swift; sourceTree = "<group>"; };
0CE8E7892C339B0600B9DC67 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
0CE8E7922C339B1B00B9DC67 /* GutenbergKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = GutenbergKit; path = ../..; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -31,6 +32,8 @@
buildActionMask = 2147483647;
files = (
0CF6E04C2BEFF60E00EDEE8A /* GutenbergKit in Frameworks */,
24CA22142E72516A007E32F8 /* GutenbergKitAssetManifestParser in Frameworks */,
24CA22122E72516A007E32F8 /* GutenbergKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -40,7 +43,6 @@
0C4F59822BEFF4970028BD96 = {
isa = PBXGroup;
children = (
0CE8E7922C339B1B00B9DC67 /* GutenbergKit */,
0CE8E7882C339B0600B9DC67 /* Sources */,
0C83424D2C339B7F00CAA762 /* Resources */,
0CE8E78A2C339B0600B9DC67 /* PreviewContent */,
Expand Down Expand Up @@ -108,6 +110,8 @@
name = Gutenberg;
packageProductDependencies = (
0CF6E04B2BEFF60E00EDEE8A /* GutenbergKit */,
24CA22112E72516A007E32F8 /* GutenbergKit */,
24CA22132E72516A007E32F8 /* GutenbergKitAssetManifestParser */,
);
productName = Gutenberg;
productReference = 0C4F598B2BEFF4970028BD96 /* Gutenberg.app */;
Expand Down Expand Up @@ -137,6 +141,9 @@
Base,
);
mainGroup = 0C4F59822BEFF4970028BD96;
packageReferences = (
24CA22102E72516A007E32F8 /* XCLocalSwiftPackageReference "../../../GutenbergKit" */,
);
productRefGroup = 0C4F598C2BEFF4970028BD96 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -377,11 +384,26 @@
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
24CA22102E72516A007E32F8 /* XCLocalSwiftPackageReference "../../../GutenbergKit" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../../../GutenbergKit;
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
0CF6E04B2BEFF60E00EDEE8A /* GutenbergKit */ = {
isa = XCSwiftPackageProductDependency;
productName = GutenbergKit;
};
24CA22112E72516A007E32F8 /* GutenbergKit */ = {
isa = XCSwiftPackageProductDependency;
productName = GutenbergKit;
};
24CA22132E72516A007E32F8 /* GutenbergKitAssetManifestParser */ = {
isa = XCSwiftPackageProductDependency;
productName = GutenbergKitAssetManifestParser;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 0C4F59832BEFF4970028BD96 /* Project object */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ios/Demo-iOS/Sources/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import GutenbergKit
import GutenbergKitAssetManifestParser

let editorURL: URL? = ProcessInfo.processInfo.environment["GUTENBERG_EDITOR_URL"].flatMap(URL.init)

Expand Down Expand Up @@ -78,6 +79,7 @@ private extension EditorConfiguration {
.setSiteApiRoot(siteApiRoot)
.setEditorAssetsEndpoint(URL(string: siteApiRoot)!.appendingPathComponent("wpcom/v2/editor-assets"))
.setShouldUsePlugins(true)
.setEditorAssetManifestParser(GutenbergKitAssetManifestParser())

return configuration.build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ class CachedAssetSchemeHandler: NSObject, WKURLSchemeHandler {
return components.url
}

nonisolated static func cachedURL(forWebLink link: String) -> String? {
if link.starts(with: "http://") || link.starts(with: "https://") {
return cachedURLSchemePrefix + link
nonisolated static func cachedURL(for url: URL) -> URL {
if url.scheme == "http" || url.scheme == "https" {
var components = URLComponents(string: url.absoluteString)!
components.scheme = cachedURLSchemePrefix + (url.scheme ?? "")
return components.url!
}
return nil

return url
}

let worker: Worker
Expand Down Expand Up @@ -105,4 +108,3 @@ class CachedAssetSchemeHandler: NSObject, WKURLSchemeHandler {
}
}
}

Loading