Skip to content

Instantly share code, notes, and snippets.

private func rewind() {
let window = UIApplication.shared.connectedScenes
.filter { $0.activationState == .foregroundActive }
.compactMap { $0 as? UIWindowScene }
.compactMap { $0.delegate as? SceneDelegate }
.compactMap { $0.window }.first
let navigationController = window?.rootViewController?.children.first?.children.first as? UINavigationController
navigationController?.popToRootViewController(animated: true)
}
@beliy
beliy / ContentView.swift
Created March 27, 2020 11:29
SwiftUI - Pull to Refresh
//
// ContentView.swift
// PullToRefresh
//
// Created by Alexey Belousov on 20.03.2020.
// Copyright © 2020 AskJack. All rights reserved.
//
import SwiftUI
import Combine
@beliy
beliy / ActivityIndicator.swift
Last active June 2, 2020 15:44
Source code for the article 'Activity Indicator in SwiftUI' (https://jetrockets.pro/blog/activity-indicator-in-swiftui)
private let kPreviewBackground = Color(red: 237/255.0, green: 85/255.0, blue: 101/255.0)
struct ActivityIndicator: View {
@State private var isAnimating: Bool = false
var body: some View {
GeometryReader { (geometry: GeometryProxy) in
ForEach(0..<5) { index in
Group {
@beliy
beliy / StretchyHeaderView.swift
Created August 9, 2019 11:11
Source code for the article 'Stretchy header in SwiftUI' (https://jetrockets.pro/blog/stretchy-header-in-swiftui)
//
// ContentView.swift
// StretchyHeader
//
// Created by Alexey Belousov on 01.08.2019.
// Copyright © 2019 JetRockets. All rights reserved.
//
import SwiftUI
@beliy
beliy / SourceTree.sh
Last active January 16, 2018 11:30
SourceTree keychain problem solver
git config --global credential.helper osxkeychain