forked from OpenSwiftUIProject/OpenSwiftUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BodyAccessor Support (OpenSwiftUIProject#38)
* Update GraphHost * Update GraphValue and GraphInputs * Add BodyAccessor and BodyAccessorRule * Add StaticBody implementation * Complete missing part of StaticBody * Update StaticBody * Add BodyAccessor.makeBody logic * Workaround non-Darwin platform build issue Tracked with OpenSwiftUIProject#39 * Add scripts and update swift-syntax version
- Loading branch information
Showing
17 changed files
with
396 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/zsh | ||
|
||
# A `realpath` alternative using the default C implementation. | ||
filepath() { | ||
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" | ||
} | ||
|
||
OG_ROOT="$(dirname $(dirname $(filepath $0)))" | ||
|
||
# Get the language and input file path from the arguments | ||
language=${1:-"swift"} | ||
input_file=${2:-"$(dirname $(filepath $0))/demangle.txt"} | ||
|
||
echo "Demangling $input_file using $language mode" | ||
|
||
# Read each line of the input file | ||
while IFS= read -r line; do | ||
# Demangle the line using the appropriate tool based on the language | ||
if [[ $language == "swift" ]]; then | ||
xcrun swift-demangle "$line" | ||
elif [[ $language == "c++" ]]; then | ||
c++filt "$line" | ||
else | ||
echo "Invalid language: $language" | ||
echo "Usage: demangle.sh <language> <input file>" | ||
echo "language: swift or c++, [default]: swift" | ||
echo "input file: [default] demangle.txt" | ||
exit 1 | ||
fi | ||
done < "$input_file" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/zsh | ||
|
||
# A `realpath` alternative using the default C implementation. | ||
filepath() { | ||
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" | ||
} | ||
|
||
OPENSWIFTUI_ROOT="$(dirname $(dirname $(filepath $0)))" | ||
|
||
cd $OPENSWIFTUI_ROOT | ||
|
||
export OPENSWIFTUI_SWIFT_TESTING=0 | ||
export OPENGRAPH_SWIFT_TESTING=0 | ||
swift build -c release -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Sources/OpenSwiftUI/Internal/BodyAccessor/BodyAccessor.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// BodyAccessor.swift | ||
// OpenSwiftUI | ||
// | ||
// Created by Kyle on 2024/2/21. | ||
// Lastest Version: iOS 15.5 | ||
// Status: Complete | ||
|
||
protocol BodyAccessor<Container, Body> { | ||
associatedtype Container | ||
associatedtype Body | ||
func updateBody(of: Container, changed: Bool) | ||
} |
16 changes: 16 additions & 0 deletions
16
Sources/OpenSwiftUI/Internal/BodyAccessor/BodyAccessorRule.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// BodyAccessorRule.swift | ||
// OpenSwiftUI | ||
// | ||
// Created by Kyle on 2024/2/21. | ||
// Lastest Version: iOS 15.5 | ||
// Status: Complete | ||
|
||
internal import OpenGraphShims | ||
|
||
protocol BodyAccessorRule { | ||
static var container: Any.Type { get } | ||
static func value<Value>(as: Value.Type, attribute: OGAttribute) -> Value? | ||
static func buffer<Value>(as: Value.Type, attribute: OGAttribute) -> _DynamicPropertyBuffer? | ||
static func metaProperties<Value>(as: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)] | ||
} |
5 changes: 2 additions & 3 deletions
5
...s/OpenSwiftUI/Internal/Graph/_Graph.swift → ...es/OpenSwiftUI/Internal/Graph/Graph.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
// | ||
// _Graph.swift | ||
// Graph.swift | ||
// OpenSwiftUI | ||
// | ||
// Created by Kyle on 2023/9/24. | ||
// Lastest Version: iOS 15.5 | ||
// Status: Complete | ||
|
||
public struct _Graph { | ||
} | ||
public struct _Graph {} |
Oops, something went wrong.