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
extension FocusedValues { | |
var myKey: Binding<String>? { | |
get { self[MyFocusKey.self] } | |
set { self[MyFocusKey.self] = newValue } | |
} | |
struct MyFocusKey: FocusedValueKey { | |
typealias Value = Binding<String> | |
} | |
} |
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 | |
// Extension to handle boolean conditions | |
extension View { | |
@ViewBuilder | |
public func `if`<Transform: View>( | |
_ value: Bool, | |
transform: (Self) -> Transform | |
) -> some View { | |
if value { |
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 DynamicTextColoring: View { | |
var body: some View { | |
VStack { | |
// только с 16 оси | |
Text("1) Коллеги и платформа \(Text("поздравляют Вас").foregroundColor(.teal))!") | |
Text(attributedCongratulationString) | |
} | |
} | |
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 LogSizes: Layout { | |
var label: String | |
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | |
assert(subviews.count == 1) | |
print(String(format: "предлагают _%@_: →%.2f x ↓%.2f", label, proposal.width ?? 0, proposal.height ?? 0)) | |
let result = subviews[0].sizeThatFits(proposal) | |
print(String(format: "ответ от _%@_: →%.2f x ↓%.2f", label, result.width, result.height)) | |
return result | |
} |
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
#!/bin/bash | |
# Проверка наличия аргументов | |
if [ $# -eq 0 ]; then | |
echo "Неправильное использование скрипта. Корректный формат: ./repeat.sh --task task.md --every week|month|year" | |
exit 1 | |
fi | |
# Проверка первых двух аргументов | |
if [ -z "$1" ] || [ -z "$2" ]; then |
OlderNewer