-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a swift-only presentSwiftView: convenience presentation helper
- Loading branch information
1 parent
bbe651f
commit eaed610
Showing
4 changed files
with
70 additions
and
3 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
20 changes: 20 additions & 0 deletions
20
JDStatusBarNotification/Public/JDStatusBarNotificationPresenter.swift
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,20 @@ | ||
// | ||
// JDStatusBarNotificationPresenter_Private.h | ||
// | ||
// Created by Markus Emrich on 10/15/23. | ||
// Copyright 2023 Markus Emrich. All rights reserved. | ||
// | ||
|
||
import JDStatusBarNotification | ||
import SwiftUI | ||
|
||
extension NotificationPresenter { | ||
|
||
func presentSwiftView(style: String? = nil, | ||
@ViewBuilder viewBuilder: () -> some View, | ||
completion: NotificationPresenterCompletion? = nil) { | ||
let controller = UIHostingController(rootView: viewBuilder()) | ||
controller.view.backgroundColor = .clear | ||
self.present(customView: controller.view, style: style, completion: completion) | ||
} | ||
} |