Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Audited for 6.5.4
// Status: Blocked by Text.Style

package import Foundation

// MARK: - AccessibilityAnnouncementPriority

@_spi(_)
Expand Down Expand Up @@ -81,14 +83,14 @@ package struct AccessibilitySpeechAttributes: Equatable {
}
}

// MARK: - Text.Style + AccessibilitySpeechAttributes [WIP]

//extension Text.Style {
// package func resolveAccessibilitySpeechAttributes(
// into attributes: inout [NSAttributedString.Key: Any],
// environment: EnvironmentValues,
// includeDefaultAttributes: Bool = true
// ) {
// _openSwiftUIUnimplementedFailure()
// }
//}
// MARK: - Text.Style + AccessibilitySpeechAttributes

extension Text.Style {
package func resolveAccessibilitySpeechAttributes(
into attributes: inout [NSAttributedString.Key: Any],
environment: EnvironmentValues,
includeDefaultAttributes: Bool = true
) {
_openSwiftUIUnimplementedFailure()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public protocol TimelineSchedule {
/// of dates in ascending order. A ``TimelineView`` that you create with a
/// schedule updates its content at the moments in time corresponding to
/// the dates included in the sequence.
associatedtype Entries: Sequence where Self.Entries.Element == Date
associatedtype Entries: Sequence where Entries.Element == Date

/// Provides a sequence of dates starting around a given date.
///
Expand Down Expand Up @@ -79,7 +79,7 @@ public protocol TimelineSchedule {
/// - mode: An indication of whether the schedule updates normally,
/// or with some other cadence.
/// - Returns: A sequence of dates in ascending order.
func entries(from startDate: Date, mode: Self.Mode) -> Self.Entries
func entries(from startDate: Date, mode: Mode) -> Entries
}

// MARK: - TimelineScheduleMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ package import Foundation
// MARK: - Accessibility + Text resolve [WIP]

extension AccessibilityCore {
package static func textResolvesToEmpty(_ text: Text, in environment: EnvironmentValues) -> Bool {
_openSwiftUIUnimplementedFailure()
package static func textResolvesToEmpty(
_ text: Text,
in environment: EnvironmentValues
) -> Bool {
guard let storedAccessibilityLabel = text.storedAccessibilityLabel else {
return text.resolvesToEmpty(in: environment, with: .includeAccessibility)
}
return textResolvesToEmpty(storedAccessibilityLabel, in: environment)
}

package static func textsResolveToEmpty(_ texts: [Text], in environment: EnvironmentValues) -> Bool {
_openSwiftUIUnimplementedFailure()
package static func textsResolveToEmpty(
_ texts: [Text],
in environment: EnvironmentValues
) -> Bool {
texts.allSatisfy { textResolvesToEmpty($0, in: environment) }
}

package static func textResolvedToPlainText(
Expand All @@ -25,7 +34,15 @@ extension AccessibilityCore {
updateResolvableAttributes: Bool = false,
idiom: AnyInterfaceIdiom? = nil
) -> String {
_openSwiftUIUnimplementedFailure()
guard let storedAccessibilityLabel = text.storedAccessibilityLabel else {
_openSwiftUIUnimplementedFailure()
}
return textResolvedToPlainText(
storedAccessibilityLabel,
in: environment,
updateResolvableAttributes: updateResolvableAttributes,
idiom: idiom
)
}

package static func textsResolvedToPlainText(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// ConfigurationBasedResolvableStringAttribute.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: Missing ResolvableAttributeConfiguration implementation
// ID: A318841E6831BFF835E45F725C9F7477 (SwiftUICore)

package import Foundation

// MARK: - ConfigurationBasedResolvableStringAttribute

package protocol ConfigurationBasedResolvableStringAttribute: ConfigurationBasedResolvableStringAttributeRepresentation, ResolvableStringAttribute {}

// MARK: - ConfigurationBasedResolvableStringAttributeRepresentation

package protocol ConfigurationBasedResolvableStringAttributeRepresentation: Decodable, Encodable, ResolvableStringAttributeFamily, ResolvableStringAttributeRepresentation {
var invalidationConfiguration: ResolvableAttributeConfiguration { get }
}

extension ConfigurationBasedResolvableStringAttributeRepresentation {
package var schedule: ResolvableAttributeConfiguration.Schedule? {
ResolvableAttributeConfiguration.Schedule(config: invalidationConfiguration)
}
}

// MARK: - ResolvableAttributeConfiguration [WIP]

package enum ResolvableAttributeConfiguration: Equatable {
case none
case interval(delay: Double? = nil)
case timer(end: Date)
case timerInterval(interval: DateInterval, countdown: Bool)
case wallClock(alignment: NSCalendar.Unit)

package var isDynamic: Bool {
switch self {
case .none: false
case .interval(let delay): delay != nil
case .timer: true
case .timerInterval: true
case .wallClock: true
}
}

mutating package func reduce(_ other: ResolvableAttributeConfiguration) {
switch (self, other) {
case let (.interval(lhsDelay), .interval(rhsDelay)):
if let lhsDelay, let rhsDelay {
self = .interval(delay: min(lhsDelay, rhsDelay))
} else {
self = .interval(delay: lhsDelay ?? rhsDelay)
}
case let (.wallClock(alignment: lhsAlignment), .wallClock(alignment: rhsAlignment)):
_openSwiftUIUnimplementedFailure()
// WIP: handle other combinations
default:
break
}
}
}

extension ResolvableAttributeConfiguration {
package struct Schedule: TimelineSchedule {
enum Alignment {
case interval(period: Double)
case timer(end: Date)
case timerInterval(interval: DateInterval, countdown: Bool)
case wallClock(alignment: NSCalendar.Unit)
}

var alignment: Alignment

package init?(config: ResolvableAttributeConfiguration) {
switch config {
case .none: return nil
case .interval(let delay):
guard let delay else {
return nil
}
alignment = .interval(period: delay)
case .timer(let end):
alignment = .timer(end: end)
case .timerInterval(let interval, let countdown):
alignment = .timerInterval(interval: interval, countdown: countdown)
case .wallClock(let alignment):
self.alignment = .wallClock(alignment: alignment)
}
}

package func entries(
from startDate: Date,
mode: TimelineScheduleMode
) -> AnySequence<Date> {
_openSwiftUIUnimplementedFailure()
}
}
}

extension ResolvableAttributeConfiguration: Codable {
enum Errors: Error {
case missingValue
}

private enum CodingKeys: CodingKey {
case interval
case delay
case wallClock
case alignment
case timer
case countdowns
case timeInterval
}

package func encode(to encoder: any Encoder) throws {
_openSwiftUIUnimplementedFailure()
}

package init(from decoder: any Decoder) throws {
_openSwiftUIUnimplementedFailure()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// ResolvableAbsoluteDate.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: WIP

package import Foundation

// MARK: - ResolvableAbsoluteDate

package struct ResolvableAbsoluteDate {
package var date: Date
package let style: Text.DateStyle
package let calendar: Calendar
package let locale: Locale
package let timeZone: TimeZone

package init(
_ date: Date,
style: Text.DateStyle,
in environment: EnvironmentValues
) {
self.date = date
self.style = style
self.calendar = environment.calendar
self.locale = environment.locale
self.timeZone = environment.timeZone
}
}

extension ResolvableAbsoluteDate: ConfigurationBasedResolvableStringAttributeRepresentation {
package static func decode(
from decoder: any Decoder
) throws -> (any ResolvableStringAttribute)? {
_openSwiftUIUnimplementedFailure()
}

package static let attribute: NSAttributedString.Key = .init("OpenSwiftUI.ResolvableAbsoluteDate")

package var invalidationConfiguration: ResolvableAttributeConfiguration {
_openSwiftUIUnimplementedFailure()
}

package func encode(to encoder: any Encoder) throws {
_openSwiftUIUnimplementedFailure()
}

package init(from decoder: any Decoder) throws {
_openSwiftUIUnimplementedFailure()
}
}

extension ResolvableAbsoluteDate: Equatable {
package static func == (a: ResolvableAbsoluteDate, b: ResolvableAbsoluteDate) -> Bool {
a.date == b.date &&
a.style == b.style &&
a.calendar == b.calendar &&
a.locale == b.locale &&
a.timeZone == b.timeZone
}
}
Loading
Loading