Skip to content

Instantly share code, notes, and snippets.

View kopyl's full-sized avatar

Oleh kopyl

View GitHub Profile
import UIKit
class SwipeNavigationController: UINavigationController {
/// Make sure you set CADisableMinimumFrameDurationOnPhone to true in Info.plist
/// Otherwise the smoothness won't be that good as with "targets" approach:
/// https://gist.github.com/kopyl/78600e5a9e0865dac02fdbd7d845139b
private var isInteractiveTransition = false
private var transitionFromVC: UIViewController?
private var transitionToVC: UIViewController?
@kopyl
kopyl / SwipeNavigationController.swift
Created January 11, 2026 18:37
"targets" approach
import UIKit
class SwipeNavigationController: UINavigationController, UIGestureRecognizerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
setupFullScreenSwipeBack()
}
private func setupFullScreenSwipeBack() {
import UIKit
private func stopScrolling(in view: UIView) {
if let scrollView = view as? UIScrollView {
scrollView.setContentOffset(scrollView.contentOffset, animated: false)
}
for subview in view.subviews {
stopScrolling(in: subview)
}
}
import UIKit
class MainView: UIView {
private let datePicker = UIDatePicker()
private let resetTimeButton = UIButton(type: .system)
private let date = Date()
init() {
super.init(frame: .zero)
datePicker.preferredDatePickerStyle = .wheels
import Cocoa
import SwiftUI
class WindowConfig {
static let width: CGFloat = 659
static let height: CGFloat = 400
static let sidebarFixedWidth: CGFloat = 215
static let sideBarTopPadding: CGFloat = 43
}
import SwiftUI
import KeyboardShortcuts
import InputMethodKit
let tabsPanelFadeOutAnimationDuration: Double = 0.25
Store.userDefaults.register(
defaults: [
Store.isTabsSwitcherNeededToStayOpenStoreKey: Store.isTabsSwitcherNeededToStayOpenDefaultvalue
]
import Cocoa
let tabHeight: CGFloat = 57
private let tabSpacing: CGFloat = 0
private let tabBottomPadding: CGFloat = 4
private let tabInsets = NSEdgeInsets(top: 0, left: 4, bottom: 0, right: 4)
private let headerHeight: CGFloat = 73
let tabContentViewWidth = tabsPanelWidth - tabInsets.left - tabInsets.right
final class TabItemView: NSView {
let tab: Tab
var onTabHover: ((Int) -> Void)?
private var firstColumnLabel: NSTextField
private var seconColumnLabel: NSTextField
public var swipeActionViewCenterYAnchorConstraint = NSLayoutConstraint()
import Cocoa
class FlippedView: NSView {
override var isFlipped: Bool {
return true
}
}
private class Spacer: NSView {
var height: CGFloat = 0
import Cocoa
class FlippedView: NSView {
override var isFlipped: Bool {
return true
}
}
private class Spacer: NSView {
var height: CGFloat = 0