-
Notifications
You must be signed in to change notification settings - Fork 70
Update Text.resolve implementation #940
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
23fe9c0
Update Text.Modifier
Kyle-Ye 4127898
Update ResolvedOption
Kyle-Ye 2544dc7
Update Text.resolve
Kyle-Ye 5f883e3
Update ResolvedText
Kyle-Ye 52c8a91
Add empty ResolvableTimer
Kyle-Ye 7cb95c0
Update TextNonDarwinShims
Kyle-Ye 0730ab5
Update _GraphInputs.defaultInterfaceIdiom
Kyle-Ye e5be4fe
Update AnyTextModifier
Kyle-Ye df92448
Add docc documentation for Text.swift
Kyle-Ye 64df187
Fix docc id
Kyle-Ye e314f12
Add Text+modifier
Kyle-Ye ed78829
Add Text renderer API documentation
Kyle-Ye 8402d0c
Fix NSTextAttachment header
Kyle-Ye 1dbcb54
Update Paragraph API
Kyle-Ye 3a8d5c4
Update Text.ResolvedProperties
Kyle-Ye 647f85d
Add OpenSwiftUITextAttachment
Kyle-Ye 1736ada
Update Text.Style.TextStyleFont
Kyle-Ye 324e0f1
Update Text.Style.TextStyleColor
Kyle-Ye da89ead
Update Text.Style
Kyle-Ye 9311d95
Add ReducedTimelineSchedule
Kyle-Ye 741a5d7
Update Text.Resolved
Kyle-Ye ca12ee5
Update append for Image.Resolved
Kyle-Ye 37f4c98
Update append for Image.NamedResolved
Kyle-Ye acdade9
Update append for ResolvableStringAttribute
Kyle-Ye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
95 changes: 95 additions & 0 deletions
95
Sources/OpenSwiftUICore/View/Text/Resolve/ResolvableTextSegmentAttribute.swift
This file contains hidden or 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,95 @@ | ||
| // | ||
| // ResolvableTextSegmentAttribute.swift | ||
| // OpenSwiftUICore | ||
| // | ||
| // Audited for 6.5.4 | ||
| // Status: Complete-Stubbed | ||
| // ID: E9C99F480CB4DD26488FF949B5D8B9E1 (SwiftUICore) | ||
|
|
||
| package import Foundation | ||
|
|
||
| // MARK: - NSAttributedString.Key + resolvableTextSegment | ||
|
|
||
| extension NSAttributedString.Key { | ||
| package static let resolvableTextSegment: NSAttributedString.Key = .init(ResolvableTextSegmentAttribute.name) | ||
| } | ||
|
|
||
| // MARK: - ResolvableTextSegmentAttribute [TODO] | ||
|
|
||
| package enum ResolvableTextSegmentAttribute: CodableAttributedStringKey { | ||
| // FIXME | ||
| package struct Value: Codable, Hashable { | ||
| package func isAttributeRequiredForResolution( | ||
| _ attribute: NSAttributedString.Key, | ||
| includeNonFunctionalAttributes: Bool | ||
| ) -> Bool { | ||
| _openSwiftUIUnimplementedFailure() | ||
| } | ||
| } | ||
|
|
||
| package static let name: String = "OpenSwiftUI.resolvableTextSegment" | ||
| } | ||
|
|
||
| extension ResolvableTextSegmentAttribute { | ||
| package static func legacySegment( | ||
| resolvableAttributeKey: NSAttributedString.Key, | ||
| length: Int | ||
| ) -> Value { | ||
| _openSwiftUIUnimplementedFailure() | ||
| } | ||
|
|
||
| package static func toggleAttributes(in string: NSMutableAttributedString) { | ||
| _openSwiftUIUnimplementedFailure() | ||
| } | ||
|
|
||
| package static func update( | ||
| _ string: NSMutableAttributedString, | ||
| in context: ResolvableStringResolutionContext | ||
| ) { | ||
| _openSwiftUIUnimplementedFailure() | ||
| } | ||
| } | ||
|
|
||
| extension ResolvableTextSegmentAttribute { | ||
| package static func buildDynamicTextSegment<R>( | ||
| for resolvable: R, | ||
| style: Text.Style, | ||
| environment: EnvironmentValues, | ||
| includeDefaultAttributes: Bool, | ||
| options: Text.ResolveOptions, | ||
| properties: inout Text.ResolvedProperties | ||
| ) -> NSMutableAttributedString? where R: ResolvableStringAttribute { | ||
| _openSwiftUIUnimplementedWarning() | ||
| return nil | ||
| } | ||
|
|
||
| package static func buildStaticTextSegment<R>( | ||
| for resolvable: R, | ||
| style: Text.Style, | ||
| environment: EnvironmentValues, | ||
| includeDefaultAttributes: Bool, | ||
| options: Text.ResolveOptions, | ||
| properties: inout Text.ResolvedProperties | ||
| ) -> NSMutableAttributedString? where R: ResolvableStringAttribute { | ||
| _openSwiftUIUnimplementedWarning() | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
| // MARK: - PlatformAttributeResolver [TODO] | ||
|
|
||
| package struct PlatformAttributeResolver { | ||
| let content: String | ||
| let style: Text.Style | ||
| let environment: EnvironmentValues | ||
| let options: Text.ResolveOptions | ||
| let defaultAttributes: [NSAttributedString.Key: Any] | ||
| var properties: Text.ResolvedProperties | ||
|
|
||
| func platformAttributes( | ||
| for container: AttributeContainer, | ||
| includeDefaultValueAttributes: Bool | ||
| ) -> [NSAttributedString.Key: Any] { | ||
| _openSwiftUIUnimplementedFailure() | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
Sources/OpenSwiftUICore/View/Text/Resolve/ResolvableTimer.swift
This file contains hidden or 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,10 @@ | ||
| // | ||
| // ResolvableTimer.swift | ||
| // OpenSwiftUICore | ||
| // | ||
| // Audited for 6.5.4 | ||
| // Status: Empty | ||
| // ID: 5596C2D3913FECC4138CDA24E2471B2B (SwiftUICore) | ||
|
|
||
| // FIXME | ||
| package struct ResolvableTimer {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift:516: SinceShadingis part of an@_silgen_namesignature that can call into SwiftUI whenOPENSWIFTUI_SWIFTUI_RENDERERis enabled, an empty placeholder type risks an ABI mismatch/undefined behavior at runtime. Consider ensuring this type’s layout matches SwiftUI’sGraphicsContext.Shading(even when you only ever passnil).Severity: high
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.