-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from p-x9/feature/propagate-other-window-events
Add option to propagate touch events to other windows
- Loading branch information
Showing
7 changed files
with
143 additions
and
45 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
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,40 @@ | ||
// | ||
// UIWindowScene+.swift | ||
// | ||
// | ||
// Created by p-x9 on 2023/09/05. | ||
// | ||
// | ||
|
||
#if canImport(UIKit) | ||
import UIKit | ||
|
||
extension UIWindowScene { | ||
static func keyboardScene(for screen: UIScreen) -> UIWindowScene? { | ||
// _keyboardWindowSceneForScreen:create: | ||
let obfuString = [":etaer", "c:nee", "rcSroF", "e", "necSwod", "niWdraobyek_"] | ||
let name = String(obfuString.joined(separator: "").reversed()) | ||
|
||
let selector = Selector(name) | ||
guard UIWindowScene.responds(to: selector), | ||
let scene = UIWindowScene.perform(selector, with: screen, with: false).takeUnretainedValue() as? UIWindowScene else { | ||
return nil | ||
} | ||
|
||
return scene | ||
} | ||
|
||
var allWindows: [UIWindow] { | ||
// _allWindows | ||
let name = String(["_", "al", "lWin", "dows"].joined(separator: "")) | ||
let selector = Selector(name) | ||
guard self.responds(to: selector), | ||
let windows = self.perform(selector).takeUnretainedValue() as? [UIWindow] else { | ||
return [] | ||
} | ||
|
||
return windows | ||
} | ||
} | ||
|
||
#endif |
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,18 @@ | ||
// | ||
// TouchTrackable.swift | ||
// | ||
// | ||
// Created by p-x9 on 2023/09/03. | ||
// | ||
// | ||
|
||
#if canImport(UIKit) | ||
import UIKit | ||
|
||
protocol TouchTrackable: UIView { | ||
func touchesBegan(_ touches: Set<UITouch>, with receiver: UIWindow) | ||
func touchesMoved(_ touches: Set<UITouch>, with receiver: UIWindow) | ||
func touchesEndedOrCancelled(_ touches: Set<UITouch>, with receiver: UIWindow) | ||
} | ||
|
||
#endif |