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
private var repeatingAnimation: Animation { | |
Animation | |
.easeInOut | |
.speed(0.15) | |
.repeatForever() | |
} |
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
WavingBackground(fill: 10) { | |
Text("Hey!") | |
} |
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
ZStack { | |
WavingBackground(fill: 10) | |
Text("Hey!") | |
} |
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 WavingBackground <Content: View>: View { | |
private let content: Content | |
private var fill: CGFloat | |
public init(fill: CGFloat = .zero, @ViewBuilder content: () -> Content) { | |
self.fill = fill | |
self.content = content() | |
} |
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
MyView() | |
.digitalCrownRotation($viewModel.drinkingAmount, | |
from: viewModel.minimumInterval, | |
through: viewModel.drinkingTarget, | |
by: 50, | |
sensitivity: .low) |
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 Wave: Shape { | |
let graphWidth: CGFloat | |
let amplitude: CGFloat | |
func path(in rect: CGRect) -> Path { | |
let width = rect.width | |
let height = rect.height |
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
private func setupGestures() { | |
view.addGestureRecognizer(Swipe(.left) { [weak self] in | |
self?.viewModel?.push(.left) | |
}) | |
view.addGestureRecognizer(Swipe(.right) { [weak self] in | |
self?.viewModel?.push(.right) | |
}) | |
view.addGestureRecognizer(Swipe(.up) { [weak self] in | |
self?.viewModel?.push(.up) | |
}) |
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
func test_when_scored_on_new_game_reset_score() { | |
robot | |
.swipeLeft() | |
.swipeRight() | |
.swipeUp() | |
.swipeDown() | |
.tapMenu() | |
.tapNewGame() | |
.assertScoreIs(0) | |
} |
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
@discardableResult | |
func tapNewGame() -> Self { | |
newGameButton?.tap() | |
return self | |
} |
NewerOlder