mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
[ios] Switched OSM profile to SwiftUI and redesigned it
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
db1ef9b148
commit
15c7e71866
41
iphone/Maps/Bridging/SafariView.swift
Normal file
41
iphone/Maps/Bridging/SafariView.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
import SwiftUI
|
||||
import SafariServices
|
||||
|
||||
|
||||
/// View for Safari via a Safari view controller
|
||||
struct SafariView: UIViewControllerRepresentable {
|
||||
// MARK: Properties
|
||||
|
||||
/// The url
|
||||
let url: URL
|
||||
|
||||
|
||||
/// The type of dismiss button
|
||||
var dismissButton: SFSafariViewController.DismissButtonStyle = .done
|
||||
|
||||
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Create a Safari view controller
|
||||
/// - Parameter context: The context
|
||||
/// - Returns: The Safari view controller
|
||||
func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
|
||||
let safariViewControllerConfiguration = SFSafariViewController.Configuration()
|
||||
safariViewControllerConfiguration.activityButton = nil
|
||||
safariViewControllerConfiguration.barCollapsingEnabled = true
|
||||
|
||||
let safariViewController = SFSafariViewController(url: url, configuration: safariViewControllerConfiguration)
|
||||
safariViewController.preferredBarTintColor = UIColor.accent
|
||||
safariViewController.preferredControlTintColor = UIColor.white
|
||||
safariViewController.dismissButtonStyle = dismissButton
|
||||
return safariViewController
|
||||
}
|
||||
|
||||
|
||||
/// Update the Safari view controller
|
||||
/// - Parameter context: The context
|
||||
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SafariView>) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user