Skip to content

Instantly share code, notes, and snippets.

View Lavmint's full-sized avatar
💭
Casually looking for a job :)

Alěkśéj Avěrkin Lavmint

💭
Casually looking for a job :)
  • Samara, Russia
View GitHub Profile
protocol LempelZivMarkovUnarchiver {
func unarchive(url: URL) throws -> URL
}
class StandartLZMUnarchiver: LempelZivMarkovUnarchiver {
func unarchive(url: URL) throws -> URL {
let algorithm: Algorithm = .lzma
let fileManager = FileManager.default
@Lavmint
Lavmint / ObjectMerger.swift
Created March 1, 2024 05:37
Merge NSObjects
protocol ObjectMerger {
func merge<T>(_ source: T, into dest: T, overwrites: Bool)
}
struct StandartObjectMerger: ObjectMerger {
func merge<T>(_ source: T, into dest: T, overwrites: Bool) {
guard let src = source as? NSObject else {
return
@Lavmint
Lavmint / CountryEmojiResolver.swift
Last active February 3, 2024 06:24
Country emoji resolver for ISO-639-1 languages (AI generated)
import Foundation
protocol CountryEmojiResolver {
func emoji(for country: String) -> String
}
class StandartCoutryEmojiResolver: CountryEmojiResolver {
func emoji(for country: String) -> String {
let languageToFlag: [String: String] = [
@Lavmint
Lavmint / Marque.swift
Created March 31, 2021 12:32
Marque horizontal view
import Foundation
import SwiftUI
extension View {
func marque() -> some View {
modifier(HorizontalMarqueModifier())
}
}
@Lavmint
Lavmint / ApplePayProvider.swift
Last active March 14, 2021 16:21
Apple pay template (not tested)
import Foundation
import Combine
import PassKit
enum Request {
static var applePay: PaymentRequestBuilder {
return PaymentRequestBuilder()
}
}
@Lavmint
Lavmint / Eyebrow.swift
Created October 30, 2020 19:58
Attempt to generate xcframeworks
//
// File.swift
//
//
// Created by Alexey Averkin on 28.10.2020.
//
import Foundation
func main() {
@Lavmint
Lavmint / Podfile.rb
Last active October 30, 2020 19:42
Example of generating xcframeworks from cocoapods in Podfile
# Uncomment the next line to define a global platform for your project
require 'find'
platform :ios, '13.0'
install! 'cocoapods', :integrate_targets => false
use_frameworks!
target 'StockQuotes' do
# Pods for StockQuotes
import Foundation
import SwiftUI
struct FocusView: View {
let path: Path
let backgroundColor: Color
init(path: Path, backgroundColor: Color = Color.black.opacity(0.3)) {
self.path = path
@Lavmint
Lavmint / TipsView.swift
Last active February 21, 2020 12:33
Tips/Hints example
import SwiftUI
import Combine
struct ContentView: View {
struct _State {
var source: CGRect?
var content: CGRect?
var isArrow: Bool {
return source != nil
@Lavmint
Lavmint / EditingView+MultilineTextField.swift
Last active September 22, 2021 14:05
SwiftUI EditingView + MultilineTextField
import SwiftUI
import Combine
struct ContentView: View {
struct _State {
var text = ""
}
@State var state = _State()