This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension View { | |
@ViewBuilder func scrollDismissesKeyboardImmediately() -> some View { | |
if #available(iOS 16.0, *) { | |
self.scrollDismissesKeyboard(.immediately) | |
} else { | |
self | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PublishedAppStorage.swift | |
import Combine | |
import SwiftUI | |
@propertyWrapper | |
struct PublishedAppStorage<Value> { | |
@UserDefault private var storedValue: Value | |
private var publisher: Publisher? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@StateObject var settings = Settings() | |
var body: some View { | |
VStack(spacing: 20) { | |
Text(settings.isActive ? "Yes" : "No") | |
Button("Toogle") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@Persistent(key: "isActive") | |
var isActive: Bool = false | |
var body: some View { | |
VStack(spacing: 20) { | |
Text(isActive ? "Yes" : "No") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MonthViewController.swift | |
// Calendar | |
// | |
// Created by Alexander T on 22.04.2023. | |
// | |
import UIKit | |
// MARK: - View Controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |