This file contains hidden or 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 { | |
var body: some View { | |
NavigationView { | |
ScrollView { | |
contents | |
} | |
.navigationTitle("title") | |
.useStickyHeaders() |
This file contains hidden or 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 { | |
var body: some View { | |
GeneralPagerView() | |
} | |
} | |
struct GeneralPagerView: View { | |
// актуальная страница |
This file contains hidden or 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
struct ContentView: View { | |
var body: some View { | |
VStack(spacing: 40) { | |
HStack(alignment: .midLeftAndRight) { | |
VStack { | |
Text("Left 1") | |
Text("Left 2") | |
.alignmentGuide(.midLeftAndRight) { | |
$0[.bottom] / 2 | |
} |
This file contains hidden or 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
struct ContentView: View { | |
@State private var animateGradient = false | |
var body: some View { | |
ZStack { | |
LinearGradient( | |
colors: [.red, .purple], | |
startPoint: animateGradient ? .topLeading : .bottomLeading, | |
endPoint: animateGradient ? .bottomTrailing : .topTrailing | |
) |
This file contains hidden or 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
final class SingleViewAccessory: UIView { | |
// MARK: - Контент | |
private let contentView: UIView | |
// MARK: - Инициализация | |
init(content: UIView, background: UIColor = .clear) { | |
// Контент |
This file contains hidden or 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
final class KeychainManager { | |
static func set(data: Data, service: String, account: String) { | |
// Данные для сохранения | |
let item = [ | |
kSecClass: kSecClassGenericPassword, | |
kSecValueData: data, | |
kSecAttrService: service, | |
kSecAttrAccount: account, | |
] as CFDictionary |
This file contains hidden or 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
final class VC1: UIViewController { | |
private lazy var gr = UITapGestureRecognizer(target: self, action: #selector(self.tap)) | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.view.backgroundColor = .systemPink | |
self.view.addGestureRecognizer(self.gr) | |
self.navigationController?.delegate = self | |
} |
This file contains hidden or 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
class ViewController: UIViewController { | |
// MARK: - Сабвью | |
private lazy var popup: UIView = { | |
let view = UIView() | |
view.backgroundColor = .systemIndigo | |
view.frame.size.height = self.state == .open ? 400.0 : 50.0 | |
return view | |
}() |
This file contains hidden or 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 UIKit | |
extension UIColor { | |
static func contrastTextColor(with background: UIColor) -> UIColor { | |
let darkText = UIColor.dark | |
let lightText = UIColor.white | |
return background.contrastRatio(with: darkText) > background.contrastRatio(with: lightText) ? darkText : lightText | |
} |
NewerOlder