generated from shilokuma-inc/template-app-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from shilokuma-inc/refactor/common
【REFACTOR】ファイル構成と共通化
- Loading branch information
Showing
10 changed files
with
204 additions
and
159 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Text+Extension.swift | ||
// PrimePickApp | ||
// | ||
// Created by 村石 拓海 on 2024/05/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public extension View { | ||
func gamingText() -> some View { | ||
self.modifier(GamingText()) | ||
} | ||
} | ||
|
||
struct GamingText: ViewModifier { | ||
@State private var hue: Double = 0 | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.foregroundColor(Color.white) | ||
.overlay( | ||
LinearGradient( | ||
gradient: Gradient(colors: [ | ||
Color.red, Color.orange, Color.yellow, Color.green, | ||
Color.blue, Color.purple, Color.red | ||
]), | ||
startPoint: .leading, | ||
endPoint: .trailing | ||
) | ||
.mask(content) | ||
.hueRotation(Angle(degrees: hue)) | ||
) | ||
.onAppear { | ||
withAnimation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) { | ||
hue = 360 | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
Text("Gaming ON!") | ||
.gamingText() | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// ContentView.swift | ||
// PrimePickApp | ||
// | ||
// Created by 村石 拓海 on 2024/04/11. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct MainView: View { | ||
@State private var hue: Double = 0 | ||
|
||
var body: some View { | ||
NavigationStack { | ||
ZStack { | ||
Color("appBlue") | ||
.ignoresSafeArea() | ||
|
||
VStack { | ||
Spacer() | ||
|
||
Text("Prime Pick") | ||
.gamingText() | ||
.font(.custom("Helvetica Neue", size: 60)) | ||
.fontWeight(.bold) | ||
|
||
|
||
Spacer() | ||
|
||
SelectDifficultyButtonView() | ||
|
||
Spacer() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
extension Difficulty { | ||
public var gradientColors: [Color] { | ||
switch self { | ||
case .easy: | ||
return [Color.green, Color.yellow] | ||
case .normal: | ||
return [Color.purple, Color.blue] | ||
case .hard: | ||
return [Color.red, Color.purple] | ||
} | ||
} | ||
} | ||
|
||
struct LazyView<Content: View>: View { | ||
let content: () -> Content | ||
|
||
init(_ content: @autoclosure @escaping () -> Content) { | ||
self.content = content | ||
} | ||
|
||
var body: Content { | ||
content() | ||
} | ||
} | ||
|
||
#Preview { | ||
MainView() | ||
} |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.