Skip to content
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: 2 additions & 0 deletions .github/workflows/ag_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'AG/**'
- 'Example/AGExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -18,6 +19,7 @@ on:
paths:
- 'AG/**'
- 'Example/AGExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bls_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'BLS/**'
- 'Example/BLSExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -18,6 +19,7 @@ on:
paths:
- 'BLS/**'
- 'Example/BLSExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/coresvg_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CoreSVGExample

on:
push:
branches: [main]
paths:
- 'CoreSVG/**'
- 'Example/CoreSVGExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
- 'Example/.mise.toml'
- 'Package.swift'
- '.github/actions/build-example/**'
- '.github/workflows/coresvg_example.yml'
pull_request:
branches: [main]
paths:
- 'CoreSVG/**'
- 'Example/CoreSVGExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
- 'Example/.mise.toml'
- 'Package.swift'
- '.github/actions/build-example/**'
- '.github/workflows/coresvg_example.yml'

jobs:
build:
name: Build CoreSVGExample (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
include:
- platform: iOS
destination: "generic/platform=iOS"
- platform: iOS Simulator
destination: "generic/platform=iOS Simulator"
- platform: macOS
destination: "platform=macOS"
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-example
with:
scheme: CoreSVGExample
destination: ${{ matrix.destination }}
xcode-version: "16.4"
2 changes: 2 additions & 0 deletions .github/workflows/coreui_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'CoreUI/**'
- 'Example/CoreUIExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -18,6 +19,7 @@ on:
paths:
- 'CoreUI/**'
- 'Example/CoreUIExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gf_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'GF/**'
- 'Example/GFExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -18,6 +19,7 @@ on:
paths:
- 'GF/**'
- 'Example/GFExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/rb_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- 'RB/**'
- 'Example/RBExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -18,6 +19,7 @@ on:
paths:
- 'RB/**'
- 'Example/RBExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/sfsymbols_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:
push:
branches: [main]
paths:
- 'SF/**'
- 'SFSymbols/**'
- 'Example/SFSymbolsExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand All @@ -16,8 +17,9 @@ on:
pull_request:
branches: [main]
paths:
- 'SF/**'
- 'SFSymbols/**'
- 'Example/SFSymbolsExample/**'
- 'Example/Resources/**'
- 'Example/Project.swift'
- 'Example/Tuist.swift'
- 'Example/Tuist/**'
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Env keys are searched with domain prefixes `DARWINPRIVATEFRAMEWORKS_` and `OPENS
| `RB/` | RenderBox | 2024 only |
| `CoreUI/` | CoreUI | 2024 only |
| `BLS/` | BacklightServices | 2024 only |
| `SF/` | SFSymbols | 2024 only |
| `SFSymbols/` | SFSymbols | 2024 only |
| `CoreSVG/` | CoreSVG | 2024 only |
| `Scripts/` | Build/install scripts | SDK installation, framework generation |
| `Plugins/` | UpdateXCFrameworks | SPM command plugin |
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions Example/BLSExample/Assets.xcassets/Contents.json

This file was deleted.

91 changes: 91 additions & 0 deletions Example/CoreSVGExample/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// ContentView.swift
// CoreSVGExample
//
// Created by Kyle on 2026/4/25.
//

import CoreSVG
import Foundation
import SwiftUI

struct ContentView: View {
var body: some View {
VStack(spacing: 16) {
SVGDocumentView(data: sampleSVGData)
.frame(width: 220, height: 220)
.background(.white)
.clipShape(RoundedRectangle(cornerRadius: 16))
.shadow(radius: 4)
Text("CoreSVG.framework")
.font(.title)
Text(canvasDescription)
.font(.caption)
.foregroundStyle(.secondary)
}
.padding()
}

private var canvasDescription: String {
guard let documentRef = CGSVGDocumentCreateFromData(sampleSVGData as CFData, nil) else {
return "Failed to create SVG document"
}
let document = documentRef.takeRetainedValue()
let size = CGSVGDocumentGetCanvasSize(document)
return "Canvas: \(Int(size.width)) x \(Int(size.height))"
}
}

private struct SVGDocumentView: View {
let data: Data

var body: some View {
Canvas { context, size in
guard let documentRef = CGSVGDocumentCreateFromData(data as CFData, nil) else {
return
}
let document = documentRef.takeRetainedValue()

let canvasSize = CGSVGDocumentGetCanvasSize(document)
guard canvasSize.width > 0, canvasSize.height > 0 else {
return
}

let scale = min(size.width / canvasSize.width, size.height / canvasSize.height)
let fittedSize = CGSize(width: canvasSize.width * scale, height: canvasSize.height * scale)
let origin = CGPoint(
x: (size.width - fittedSize.width) / 2,
y: (size.height - fittedSize.height) / 2
)

context.withCGContext { cgContext in
cgContext.saveGState()
cgContext.translateBy(x: origin.x, y: origin.y)
cgContext.scaleBy(x: scale, y: scale)
CGContextDrawSVGDocument(cgContext, document)
cgContext.restoreGState()
}
}
}
}

private let sampleSVGData = Data(
"""
<svg xmlns="http://www.w3.org/2000/svg" width="180" height="180" viewBox="0 0 180 180">
<defs>
<linearGradient id="sky" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#38bdf8"/>
<stop offset="1" stop-color="#6366f1"/>
</linearGradient>
</defs>
<rect width="180" height="180" rx="36" fill="url(#sky)"/>
<circle cx="70" cy="68" r="34" fill="#fef3c7"/>
<path d="M34 132 L78 90 L110 120 L132 98 L158 132 Z" fill="#14532d"/>
<path d="M34 132 L78 90 L110 120 L132 98 L158 132 Z" fill="#22c55e" opacity="0.65"/>
</svg>
""".utf8
)

#Preview {
ContentView()
}
17 changes: 17 additions & 0 deletions Example/CoreSVGExample/ExampleApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ExampleApp.swift
// CoreSVGExample
//
// Created by Kyle on 2026/4/25.
//

import SwiftUI

@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

This file was deleted.

Loading
Loading