Skip to content

Instantly share code, notes, and snippets.

View azonov's full-sized avatar

Andrey azonov

  • Т-Банк
  • Russia
View GitHub Profile
import UIKit
public class ScrollableStackView: UIView {
// MARK: Private Properties
private lazy var scrollView: UIScrollView = {
let scrollView = UIScrollView(frame: .zero)
scrollView.backgroundColor = .clear
scrollView.translatesAutoresizingMaskIntoConstraints = false
//
// ViewController.swift
// Demo
//
// Created by Andey on 04.01.2023.
//
import Combine
import UIKit
struct Weakify<Object: AnyObject> {
weak var object: Object?
}
func weak<Object: AnyObject>(_ object: Object) -> Weakify<Object> {
Weakify(object: object)
}
extension StringProtocol {
subscript(_ offset: Int) -> String.Element {
if offset >= 0 {
self[index(startIndex, offsetBy: offset)]
} else {
self[index(endIndex, offsetBy: offset)]
}
}