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
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ public struct ContentTransition: Equatable, Sendable {
/// system uses an opacity transition instead.
public static let interpolate: ContentTransition = .init(storage: .named(.init())) // FIXME

public static func numericText(countsDown: Bool = false) -> ContentTransition {
// FIXME
.init(storage: .named(.init(name: .numericText(.init(direction: .fixed(downwards: countsDown))))))
}

@_spi(Private)
@available(*, deprecated, message: "replaced by numericText(countsDown:)")
public static func numericText(increasing: Bool) -> ContentTransition {
.numericText(countsDown: !increasing)
}

// MARK: - ContentTransition.Options

@_spi(Private)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// CalendarDependentFormatStyle.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: Complete (Blocked by WhitespaceRemovingFormatStyle/SystemFormatStyle)
// ID: 26D279F2E8972E56094553A13FA39915 (SwiftUICore)

package import Foundation

protocol CalendarDependentFormatStyle: FormatStyle {
func withCalendar(_ calendar: Calendar) -> Self
}

extension FormatStyle {
package func calendar(_ calendar: Calendar) -> Self {
guard let style = self as? any CalendarDependentFormatStyle else {
return self
}
return style.withCalendar(calendar) as! Self
}
}

#if canImport(Darwin)
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
extension Date.FormatStyle: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
var style = self
style.calendar = calendar
return style
}
}

@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
extension Date.VerbatimFormatStyle: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
var style = self
style.calendar = calendar
return style
}
}

@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
extension Date.ComponentsFormatStyle: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
self.calendar(calendar)
}
}

@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
extension Date.FormatStyle.Attributed: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
var style = self
style[dynamicMember: \.calendar] = calendar
return style
}
}

@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
extension Date.VerbatimFormatStyle.Attributed: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
var style = self
style[dynamicMember: \.calendar] = calendar
return style
}
}

@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
extension Date.AnchoredRelativeFormatStyle: CalendarDependentFormatStyle {
func withCalendar(_ calendar: Calendar) -> Self {
var style = self
style.calendar = calendar
return style
}
}

// TODO: Add conformance when these concrete format styles land:
// WhitespaceRemovingFormatStyle where A: CalendarDependentFormatStyle
// SystemFormatStyle.DateReference
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Status: Complete (Blocked by SystemFormatStyle)
// ID: B2C9C13C743DF2F6E22ED614C39E3A5D (SwiftUICore)

#if canImport(Darwin)
public import Foundation

protocol CapitalizationContextDependentFormatStyle: FormatStyle {
Expand Down Expand Up @@ -44,4 +43,3 @@ extension EnvironmentValues {
// Date.AnchoredRelativeFormatStyle
// Date.FormatStyle
// ...
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// protocol ContentTransitionProvidingFormatStyle.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: WIP (Blocked by SystemFormatStyle)

package import Foundation

package protocol ContentTransitionProvidingFormatStyle<FormatInput>: FormatStyle {
func contentTransition<Source>(
for source: Source
) -> ContentTransition where Source: TimeDataSourceStorage, Source.Value == FormatInput
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// InterfaceIdiomDependentFormatStyle.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: WIP (Blocked by SystemFormatStyle)

import Foundation

protocol InterfaceIdiomDependentFormatStyle: FormatStyle {
func interfaceIdiom(_ idiom: AnyInterfaceIdiom) -> Self
}

// TODO: Add conformance when these concrete format styles land:
// SystemFormatStyle.Timer
// SystemFormatStyle.Stopwatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// SafelySerializableDiscreteFormatStyle.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: WIP
// ID: 6E7304511B702F2103288779936F04AA (SwiftUICore)

import Foundation

protocol SafelySerializableDiscreteFormatStyle: DiscreteFormatStyle where FormatOutput: AttributedStringConvertible {
static func representation<Source>(
of resolvable: TimeDataFormatting.Resolvable<Source, Self>,
for version: ArchivedViewInput.DeploymentVersion
) -> any ResolvableStringAttributeRepresentation
where Source: TimeDataSourceStorage, Source.Value == FormatInput
}

// TODO: Conformance
Loading
Loading