Skip to content

Commit

Permalink
0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nathantannar4 committed Nov 30, 2022
1 parent 438cdbe commit 902a68a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
14 changes: 14 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "engine",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nathantannar4/Engine",
"state" : {
"revision" : "6bd1d983e1f7aaae5a1928fbc78a6415701e2cac",
"version" : "0.1.1"
}
}
],
"version" : 2
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/nathantannar4/Engine", from: "0.1.1"),
.package(url: "https://github.com/nathantannar4/Turbocharger", from: "0.1.0"),
.package(url: "https://github.com/nathantannar4/Turbocharger", from: "0.1.1"),
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ extension View {
public func presentation<T, Destination: View>(
_ value: Binding<T?>,
transition: PresentationLinkTransition = .default,
@ViewBuilder destination: (T) -> Destination
@ViewBuilder destination: (Binding<T>) -> Destination
) -> some View
}
```
Expand Down Expand Up @@ -336,7 +336,7 @@ extension View {
_ value: Binding<T?>,
level: WindowLinkLevel = .default,
transition: WindowLinkTransition = .opacity,
@ViewBuilder destination: (T) -> D
@ViewBuilder destination: (Binding<T>) -> D
) -> some View
}
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Copyright (c) Nathan Tannar
//

import SwiftUI

extension Binding {
@inlinable
public func unwrap<Wrapped>() -> Binding<Wrapped>? where Optional<Wrapped> == Value {
guard let value = self.wrappedValue else { return nil }
return Binding<Wrapped>(
get: { return value },
set: { value in
self.wrappedValue = value
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ extension View {
public func presentation<T, Destination: View>(
_ value: Binding<T?>,
transition: PresentationLinkTransition = .default,
@ViewBuilder destination: (T) -> Destination
@ViewBuilder destination: (Binding<T>) -> Destination
) -> some View {
presentation(transition: transition, isPresented: value.isNotNil()) {
OptionalAdapter(value.wrappedValue, content: destination)
OptionalAdapter(value, content: destination)
}
}
}
Expand Down Expand Up @@ -281,7 +281,7 @@ private struct PresentationLinkAdapterBody<
// Swizzle to hook up for programatic dismissal
adapter.viewController.presentationDelegate = context.coordinator
if let presentedViewController = presentingViewController.presentedViewController {
presentedViewController.dismiss(animated: false) {
presentedViewController.dismiss(animated: isAnimated) {
presentingViewController.present(adapter.viewController, animated: isAnimated)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Transmission/Sources/View/WindowLinkAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ extension View {
_ value: Binding<T?>,
level: WindowLinkLevel = .default,
transition: WindowLinkTransition = .opacity,
@ViewBuilder destination: (T) -> D
@ViewBuilder destination: (Binding<T>) -> D
) -> some View {
window(level: level, transition: transition, isPresented: value.isNotNil()) {
OptionalAdapter(value.wrappedValue, content: destination)
OptionalAdapter(value, content: destination)
}
}
}
Expand Down

0 comments on commit 902a68a

Please sign in to comment.