-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove-media-link
- Loading branch information
Showing
13 changed files
with
244 additions
and
270 deletions.
There are no files selected for viewing
This file contains 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 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 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,25 @@ | ||
import SwiftUI | ||
|
||
extension ScrollViewProxy { | ||
/// Animates and scrolls to the bottom of the specified view using the provided namespace ID. | ||
/// | ||
/// This function triggers two animations: | ||
/// 1. A binding value (`isAnimating`) is set to `true` with an animation. | ||
/// 2. The scroll view is then animated to scroll to the bottom of the view identified by the specified `id`. | ||
/// | ||
/// - Parameters: | ||
/// - viewID: The namespace ID of the view to scroll to. | ||
/// - isAnimating: Controls when to animate. | ||
func animateAndScrollTo( | ||
_ viewID: Namespace.ID, | ||
animating isAnimating: Binding<Bool> | ||
) { | ||
withAnimation(.easeInOut(duration: 0.5)) { | ||
isAnimating.wrappedValue = true | ||
} | ||
|
||
withAnimation(.easeInOut(duration: 0.5)) { | ||
scrollTo(viewID, anchor: .bottom) | ||
} | ||
} | ||
} |
This file contains 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 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,27 @@ | ||
import SwiftUI | ||
import LinkPresentation | ||
|
||
/// A view that displays an Open Graph Protocol preview of the given URL. | ||
struct LPLinkViewRepresentable: UIViewRepresentable { | ||
|
||
/// The URL of the content to display. | ||
let url: URL | ||
|
||
func makeUIView(context: Context) -> LPLinkView { | ||
let linkView = LPLinkView(url: url) | ||
linkView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) | ||
linkView.setContentCompressionResistancePriority(.defaultLow, for: .vertical) | ||
linkView.sizeToFit() | ||
return linkView | ||
} | ||
|
||
func updateUIView(_ uiView: LPLinkView, context: Context) { | ||
let provider = LPMetadataProvider() | ||
provider.startFetchingMetadata(for: url) { metadata, error in | ||
guard let metadata = metadata, error == nil else { return } | ||
DispatchQueue.main.async { | ||
uiView.metadata = metadata | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.