Skip to content

Instantly share code, notes, and snippets.

View shima11's full-sized avatar
🥑

shima shima11

🥑
  • Tokyo, Japan
View GitHub Profile
class TooltipTouchDetectWindow: UIWindow, TouchableNodeWindowType {
public var touchableNodeTable = NSHashTable<AnyTouchableNode>(options: .weakMemory)
override final public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let touchedView = super.hitTest(point, with: event)
let touchedTooltipNodes = touchableNodeTable.allObjects.lazy.filter { tooltip -> Bool in
tooltip.view
final class TooltipBodyView: UIView {
override func didMoveToWindow() {
super.didMoveToWindow()
// 2.
addToTooltipManagementTable()
}
func addToTooltipManagementTable() {
class TooltipTouchDetectWindow: UIWindow, TouchableNodeWindowType {
// 1.
public var touchableNodeTable = NSHashTable<AnyTouchableNode>(options: .weakMemory)
override final public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
// 3.
let view = super.hitTest(point, with: event)
import UIKit
import PlaygroundSupport
// https://developer.apple.com/design/human-interface-guidelines/ios/controls/edit-menus/
// https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/UsingCopy,Cut,andPasteOperations/UsingCopy,Cut,andPasteOperations.html#//apple_ref/doc/uid/TP40009542-CH11-SW1
public final class CopyableView<T: UIView, Value>: UIView {
public override var canBecomeFirstResponder: Bool {
return true
@shima11
shima11 / styleable.swift
Last active May 27, 2020 01:46
Styleable
import Foundation
protocol Styleable {
associatedtype Base: AnyObject
var style: StyleObject<Base> { get }
}
extension Styleable {
public var style: StyleObject<Self> {