Skip to content

Instantly share code, notes, and snippets.

View evnik's full-sized avatar
🇺🇦
Stand with Ukraine️!

Eugene Berdnikov evnik

🇺🇦
Stand with Ukraine️!
View GitHub Profile
@evnik
evnik / GenericCasting.swift
Created July 13, 2022 14:55
Playing around casting of generic protocol
protocol AnyProtocol {
func checkAndRemove<T>(_ predicate: (T) -> Bool) -> Bool
func checkAndRemove<T>() -> T?
func insert<T>(_ value: T)
}
protocol ProtocolA: AnyProtocol {
associatedtype T
var size: Int { get }
@evnik
evnik / WeakTest.swift
Created February 5, 2021 14:40
Testing hashable weak reference
import Foundation
class WeakWrapper: Hashable {
private(set) weak var value: AnyObject?
init(_ value: AnyObject) {
self.value = value
}
static func == (lhs: WeakWrapper, rhs: WeakWrapper) -> Bool {
@evnik
evnik / Framework2XCFramework.sh
Created December 30, 2020 20:23
This script allows to convert an iOS framework binary to XCFramework
# Copyright (c) 2020 Eugene Berdnikov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all