Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nathantannar4/Turbocharger
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1.2
Choose a base ref
...
head repository: nathantannar4/Turbocharger
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jan 20, 2023

  1. 0.1.3

    nathantannar4 committed Jan 20, 2023
    Copy the full SHA
    d5e0660 View commit details

Commits on Jan 25, 2023

  1. 0.1.4

    nathantannar4 committed Jan 25, 2023
    Copy the full SHA
    fba6c6b View commit details

Commits on Mar 27, 2023

  1. 0.1.5

    nathantannar4 committed Mar 27, 2023
    Copy the full SHA
    a3be33e View commit details

Commits on Apr 19, 2023

  1. 0.1.6

    nathantannar4 committed Apr 19, 2023
    Copy the full SHA
    97472f1 View commit details

Commits on Jun 6, 2023

  1. 0.1.7

    nathantannar4 committed Jun 6, 2023
    Copy the full SHA
    598b0f3 View commit details

Commits on Jun 27, 2023

  1. 0.1.8

    nathantannar4 committed Jun 27, 2023
    Copy the full SHA
    dc4984a View commit details

Commits on Oct 17, 2023

  1. 0.1.9

    nathantannar4 committed Oct 17, 2023
    Copy the full SHA
    9046123 View commit details

Commits on Nov 2, 2023

  1. 1.0.0

    nathantannar4 committed Nov 2, 2023
    Copy the full SHA
    71b88f4 View commit details

Commits on Nov 18, 2023

  1. 1.0.1

    nathantannar4 committed Nov 18, 2023
    Copy the full SHA
    b4201ba View commit details

Commits on Jan 16, 2024

  1. 1.1.0

    nathantannar4 committed Jan 16, 2024
    Copy the full SHA
    989cb78 View commit details

Commits on Jan 24, 2024

  1. 1.1.1

    nathantannar4 committed Jan 24, 2024
    Copy the full SHA
    ede3eba View commit details

Commits on Feb 28, 2024

  1. 1.1.2

    nathantannar4 committed Feb 28, 2024
    1
    Copy the full SHA
    21771ea View commit details
  2. 1.1.3

    nathantannar4 committed Feb 28, 2024
    Copy the full SHA
    b71236b View commit details

Commits on Feb 29, 2024

  1. 1.1.4

    nathantannar4 committed Feb 29, 2024
    Copy the full SHA
    095344c View commit details

Commits on Apr 8, 2024

  1. 1.1.5

    nathantannar4 committed Apr 8, 2024
    Copy the full SHA
    54fd495 View commit details

Commits on Apr 17, 2024

  1. 1.2.0

    nathantannar4 committed Apr 17, 2024
    Copy the full SHA
    52f22b9 View commit details

Commits on Jun 13, 2024

  1. 1.3.0

    nathantannar4 committed Jun 13, 2024
    1
    Copy the full SHA
    9420e40 View commit details

Commits on Jun 18, 2024

  1. 1.3.1

    nathantannar4 committed Jun 18, 2024
    Copy the full SHA
    855b631 View commit details

Commits on Jul 31, 2024

  1. 1.3.2

    nathantannar4 committed Jul 31, 2024
    Copy the full SHA
    eb872a6 View commit details

Commits on Nov 1, 2024

  1. 1.3.3

    nathantannar4 committed Nov 1, 2024
    Copy the full SHA
    c504e85 View commit details

Commits on Feb 21, 2025

  1. 2.0.0

    nathantannar4 committed Feb 21, 2025
    Copy the full SHA
    778f721 View commit details
Showing with 3,467 additions and 834 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 .swiftpm/xcode/xcshareddata/xcschemes/Turbocharger.xcscheme
  3. +0 −14 Package.resolved
  4. +4 −3 Package.swift
  5. +19 −14 README.md
  6. +39 −0 Sources/Turbocharger/Sources/Alignment/FirstTextMidline.swift
  7. +86 −0 Sources/Turbocharger/Sources/Core/ArrayBuilder.swift
  8. +20 −0 Sources/Turbocharger/Sources/Core/IdentifiableBox.swift
  9. +0 −34 Sources/Turbocharger/Sources/DynamicProperty/BindingTransform.swift
  10. +2 −1 Sources/Turbocharger/Sources/DynamicProperty/FormatTransform.swift
  11. +0 −63 Sources/Turbocharger/Sources/DynamicProperty/IsNilTransform.swift
  12. +0 −63 Sources/Turbocharger/Sources/DynamicProperty/IsNotNilTransform.swift
  13. +0 −37 Sources/Turbocharger/Sources/DynamicProperty/MapTransform.swift
  14. +16 −0 Sources/Turbocharger/Sources/DynamicProperty/OptionalObservedObject.swift
  15. +23 −6 Sources/Turbocharger/Sources/DynamicProperty/OptionalStateObject.swift
  16. +5 −0 Sources/Turbocharger/Sources/DynamicProperty/PublishedState.swift
  17. +0 −20 Sources/Turbocharger/Sources/DynamicProperty/UnwrapTransform.swift
  18. +47 −0 Sources/Turbocharger/Sources/Extensions/Alignment+Extensions.swift
  19. +47 −0 Sources/Turbocharger/Sources/Extensions/EdgeInsets+Extensions.swift
  20. +1 −27 Sources/Turbocharger/Sources/{Core → Extensions}/Transaction+Extensions.swift
  21. +0 −20 Sources/Turbocharger/Sources/PreferenceKey/OptionalPreferenceKey.swift
  22. +20 −3 Sources/Turbocharger/Sources/View/AdaptiveStack.swift
  23. +179 −0 Sources/Turbocharger/Sources/View/CALayerRepresentable.swift
  24. +784 −0 Sources/Turbocharger/Sources/View/CollectionView.swift
  25. +136 −0 Sources/Turbocharger/Sources/View/CollectionViewRepresentable.swift
  26. +158 −136 Sources/Turbocharger/Sources/View/FlowStack.swift
  27. +420 −0 Sources/Turbocharger/Sources/View/FluidGradient.swift
  28. +70 −0 Sources/Turbocharger/Sources/View/ForEach.swift
  29. +43 −21 Sources/Turbocharger/Sources/View/LabeledView.swift
  30. +323 −0 Sources/Turbocharger/Sources/View/MarqueeHStack.swift
  31. +191 −0 Sources/Turbocharger/Sources/View/MarqueeText.swift
  32. +0 −67 Sources/Turbocharger/Sources/View/OptionalAdapter.swift
  33. +175 −0 Sources/Turbocharger/Sources/View/PlatformViewRepresentable.swift
  34. +0 −60 Sources/Turbocharger/Sources/View/ProposedSize.swift
  35. +5 −5 Sources/Turbocharger/Sources/View/RadialStack.swift
  36. +0 −34 Sources/Turbocharger/Sources/View/SymmetricallyScaledText.swift
  37. +0 −96 Sources/Turbocharger/Sources/View/TextBuilder.swift
  38. +0 −62 Sources/Turbocharger/Sources/View/TextReader.swift
  39. +4 −4 Sources/Turbocharger/Sources/View/WeightedHStack.swift
  40. +2 −2 Sources/Turbocharger/Sources/View/WeightedPriority.swift
  41. +4 −4 Sources/Turbocharger/Sources/View/WeightedVStack.swift
  42. +46 −0 Sources/Turbocharger/Sources/ViewModifier/Accessibility.swift
  43. +17 −3 Sources/Turbocharger/Sources/ViewModifier/AlignmentOffset.swift
  44. +67 −7 Sources/Turbocharger/Sources/ViewModifier/Badge.swift
  45. +20 −4 Sources/Turbocharger/Sources/ViewModifier/Hidden.swift
  46. +50 −0 Sources/Turbocharger/Sources/ViewModifier/OnAppearAndChange.swift
  47. +1 −2 Sources/Turbocharger/Sources/{View → ViewModifier}/ProposedSizeObserver.swift
  48. +7 −21 Sources/Turbocharger/Sources/ViewModifier/SafeArea.swift
  49. +126 −0 Sources/Turbocharger/Sources/ViewModifier/ScaledFrame.swift
  50. +308 −0 Sources/Turbocharger/Sources/ViewModifier/Shimmer.swift
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -7,3 +7,4 @@ DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Package.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
14 changes: 0 additions & 14 deletions Package.resolved

This file was deleted.

7 changes: 4 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.9

import PackageDescription

@@ -9,7 +9,8 @@ let package = Package(
.macOS(.v10_15),
.macCatalyst(.v13),
.tvOS(.v13),
.watchOS(.v6)
.watchOS(.v6),
.visionOS(.v1)
],
products: [
.library(
@@ -18,7 +19,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/nathantannar4/Engine", from: "0.1.1"),
.package(url: "https://github.com/nathantannar4/Engine", from: "2.0.0"),
],
targets: [
.target(
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,10 +6,15 @@

> Built for performance and backwards compatibility using [Engine](https://github.com/nathantannar4/Engine)
## See Also

- [Ignition](https://github.com/nathantannar4/Ignition)
- [Transmission](https://github.com/nathantannar4/Transmission)

## Requirements

- Deployment target: iOS 13.0, macOS 10.15, tvOS 13.0, or watchOS 6.0
- Xcode 14.1+
- Xcode 15+

## Installation

@@ -47,10 +52,10 @@ let package = Package(

### LabeledView

```
```swift
/// The ``ViewStyle`` for ``LabeledView``
public protocol LabeledViewStyle: ViewStyle where Configuration == LabeledViewStyleConfiguration {
associatedtype Configuration = Configuration
}

/// The ``ViewStyledView.Configuration`` for ``LabeledView``
@@ -76,7 +81,7 @@ public struct LabeledView<Label: View, Content: View>: View {

### HVStack/AdaptiveStack

```
```swift
/// A view that arranges its subviews in a vertical or horizontal line.
@frozen
public struct HVStack<Content: View>: View {
@@ -105,7 +110,7 @@ public struct AdaptiveStack<Content: View>: View {

### WeightedHStack/WeightedVStack

```
```swift
/// A view that arranges its subviews in a horizontal line a width
/// that is relative to its `LayoutWeightPriority`.
///
@@ -145,7 +150,7 @@ extension View {

### FlowStack

```
```swift
/// A view that arranges its subviews along multiple horizontal lines.
@frozen
public struct FlowStack<Content: View>: View {
@@ -160,7 +165,7 @@ public struct FlowStack<Content: View>: View {

### RadialStack

```
```swift
/// A view that arranges its subviews along a radial circumference.
@frozen
public struct RadialStack<Content: View>: View {
@@ -171,7 +176,7 @@ public struct RadialStack<Content: View>: View {

### OptionalAdapter

```
```swift
/// A view maps an `Optional` value to it's `Content` or `Placeholder`.
@frozen
public struct OptionalAdapter<
@@ -212,7 +217,7 @@ extension OptionalAdapter where Placeholder == EmptyView {

### ResultAdapter

```
```swift
/// A view maps a `Result` value to it's `SuccessContent` or `FailureContent`.
@frozen
public struct ResultAdapter<
@@ -252,13 +257,13 @@ extension ResultAdapter where FailureContent == EmptyView {

### BindingTransform

```
```swift
public protocol BindingTransform {
associatedtype Input
associatedtype Output

func get(_ value: Input) -> Output
func set(_ newValue: Output, oldValue: @autoclosure () -> Input, transaction: Transaction) throws -> Input
func set(_ newValue: Output, oldValue: @autoclosure () -> Input) throws -> Input
}

extension Binding {
@@ -280,7 +285,7 @@ extension Binding {

### SafeAreaPadding

```
```swift
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
extension View {
@inlinable
@@ -296,7 +301,7 @@ extension View {

### Badge

```
```swift
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
extension View {
@inlinable
@@ -311,7 +316,7 @@ extension View {

### Accessibility

```
```swift
extension View {
/// Disables accessibility elements from being generated, even when an assistive technology is running
@inlinable
39 changes: 39 additions & 0 deletions Sources/Turbocharger/Sources/Alignment/FirstTextMidline.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Copyright (c) Nathan Tannar
//

import SwiftUI

extension VerticalAlignment {
private enum FirstTextMidline: AlignmentID {
static func defaultValue(in context: ViewDimensions) -> CGFloat {
let dy = context[.lastTextBaseline] - context[.firstTextBaseline]
let lineHeight = context.height - dy
return lineHeight / 2
}
}

public static let firstTextMidline = VerticalAlignment(FirstTextMidline.self)
}

// MARK: - Previews

struct FirstTextMidline_Previews: PreviewProvider {
static var previews: some View {
VStack {
HStack(alignment: .firstTextMidline) {
Color.red
.frame(width: 32, height: 32)

Text("Lorem ipsum")
}

HStack(alignment: .firstTextMidline) {
Color.red
.frame(width: 32, height: 32)

Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
}
}
}
}
86 changes: 86 additions & 0 deletions Sources/Turbocharger/Sources/Core/ArrayBuilder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// Copyright (c) Nathan Tannar
//

import SwiftUI

/// A custom parameter attribute that constructs an array from closures.
@frozen
@resultBuilder
public struct ArrayBuilder<Element> {

@inlinable
public static func buildBlock() -> [Optional<Element>] {
[]
}

@inlinable
public static func buildPartialBlock(
first: [Optional<Element>]
) -> [Optional<Element>] {
first
}

@inlinable
public static func buildPartialBlock(
accumulated: [Optional<Element>],
next: [Optional<Element>]
) -> [Optional<Element>] {
accumulated + next
}

@inlinable
public static func buildExpression(
_ expression: Element
) -> [Optional<Element>] {
[expression]
}

@inlinable
public static func buildEither(
first component: [Optional<Element>]
) -> [Optional<Element>] {
component
}

@inlinable
public static func buildEither(
second component: [Optional<Element>]
) -> [Optional<Element>] {
component
}

@inlinable
public static func buildOptional(
_ component: [Optional<Element>]?
) -> [Optional<Element>] {
component ?? []
}

@inlinable
public static func buildLimitedAvailability(
_ component: [Optional<Element>]
) -> [Optional<Element>] {
component
}

@inlinable
public static func buildArray(
_ components: [Optional<Element>]
) -> [Optional<Element>] {
components
}

@inlinable
public static func buildBlock(
_ components: [Optional<Element>]...
) -> [Optional<Element>] {
components.flatMap { $0 }
}

public static func buildFinalResult(
_ component: [Optional<Element>]
) -> [Element] {
component.compactMap { $0 }
}
}
20 changes: 20 additions & 0 deletions Sources/Turbocharger/Sources/Core/IdentifiableBox.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) Nathan Tannar
//

import SwiftUI

@frozen
public struct IdentifiableBox<Value, ID: Hashable>: Identifiable {
public var value: Value
public var keyPath: KeyPath<Value, ID>

public var id: ID { value[keyPath: keyPath] }

@inlinable
public init(_ value: Value, id keyPath: KeyPath<Value, ID>) {
self.value = value
self.keyPath = keyPath
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
//

import SwiftUI
import Engine

/// A ``BindingTransform`` that transforms the value
/// with a `ParseableFormatStyle`
@@ -26,7 +27,7 @@ public struct FormatTransform<F: ParseableFormatStyle>: BindingTransform where F
format.format(value)
}

public func set(_ newValue: Output, oldValue: @autoclosure () -> Input, transaction: Transaction) throws -> Input {
public func set(_ newValue: Output, oldValue: @autoclosure () -> Input) throws -> Input {
do {
return try format.parseStrategy.parse(newValue)
} catch {
Loading