Skip to content

Instantly share code, notes, and snippets.

View mezhevikin's full-sized avatar
:octocat:

Mezhevikin Alexey mezhevikin

:octocat:
View GitHub Profile
var fieldsView: some View {
VStack(spacing: .padding) {
ForEach(state.converter.fields.prefix(state.props.countOfFields)) { field in
HStack(spacing: .padding) {
CurrencyButton(field: field)
ConverterFieldView(field: field)
}
}
}
}
@mezhevikin
mezhevikin / View+Keboard.swift
Created August 27, 2023 07:59
scrollDismissesKeyboardImmediately for ios 15
import SwiftUI
extension View {
@ViewBuilder func scrollDismissesKeyboardImmediately() -> some View {
if #available(iOS 16.0, *) {
self.scrollDismissesKeyboard(.immediately)
} else {
self
}
}
@mezhevikin
mezhevikin / TouchDownButton.swift
Created August 21, 2023 07:34
TouchDownButton.swift
import SwiftUI
struct ContentView: View {
var body: some View {
TouchDownButton(action: {
print("touchDown")
}) {
Text("Test")
}.onLongPressGesture {
print("longPress")
package com.mezhevikin.converter.testus
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.*
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
// PublishedAppStorage.swift
import Combine
import SwiftUI
@propertyWrapper
struct PublishedAppStorage<Value> {
@UserDefault private var storedValue: Value
private var publisher: Publisher?
@mezhevikin
mezhevikin / ContentView2.swift
Last active July 11, 2023 13:19
ContentView2.swift
import SwiftUI
struct ContentView: View {
@StateObject var settings = Settings()
var body: some View {
VStack(spacing: 20) {
Text(settings.isActive ? "Yes" : "No")
Button("Toogle") {
@mezhevikin
mezhevikin / ContentView.swift
Created July 11, 2023 13:08
ContentView.swift
import SwiftUI
struct ContentView: View {
@Persistent(key: "isActive")
var isActive: Bool = false
var body: some View {
VStack(spacing: 20) {
Text(isActive ? "Yes" : "No")
@mezhevikin
mezhevikin / MonthViewController.swift
Created April 24, 2023 13:36 — forked from mrtapac/MonthViewController.swift
UICollectionViewCompositionalLayout month calendar example
//
// MonthViewController.swift
// Calendar
//
// Created by Alexander T on 22.04.2023.
//
import UIKit
// MARK: - View Controller
@mezhevikin
mezhevikin / Context.kt
Created January 3, 2023 09:04
Detect android tablet
val Context.isTablet: Boolean get() {
val layout = resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
return layout == Configuration.SCREENLAYOUT_SIZE_LARGE || layout == Configuration.SCREENLAYOUT_SIZE_XLARGE
}