Skip to content

Commit 3a3c4bf

Browse files
committed
chore: several improvements
1 parent 5a4a7d3 commit 3a3c4bf

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// AnimatedGradientBackground.swift
3-
// GiphyGIF
3+
// Giffy
44
//
55
// Created by Uwais Alqadri on 28/4/24.
66
//
@@ -10,24 +10,19 @@ import SwiftUI
1010
struct AnimatedGradientBackground: View {
1111

1212
@State private var shouldAnimate = false
13+
var colors: [Color] = [.Theme.purple, .Theme.red]
1314

1415
var body: some View {
1516
LinearGradient(
16-
colors: [.Theme.purple, .Theme.red],
17+
colors: colors,
1718
startPoint: shouldAnimate ? .topLeading : .bottomTrailing,
1819
endPoint: shouldAnimate ? .bottomTrailing : .topLeading
1920
)
2021
.onAppear {
21-
let animation = Animation.easeOut(duration: 2.0).repeatForever(autoreverses: true)
22+
let animation = Animation.easeInOut(duration: 4.0).repeatForever(autoreverses: true)
2223
withAnimation(animation) {
2324
shouldAnimate.toggle()
2425
}
25-
26-
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
27-
withAnimation(animation) {
28-
self.shouldAnimate.toggle()
29-
}
30-
}
3126
}
3227
}
3328
}

Giffy/Features/Search/GiffyGridRow.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ struct GiffyGridRow: View {
1515

1616
@State private var downloadedImage: Data?
1717
let giphy: Giffy
18-
18+
1919
var onTapRow: ((Giffy) -> Void)?
20-
20+
2121
var body: some View {
2222
VStack(alignment: .leading) {
2323
AnimatedImage(
2424
url: URL(string: giphy.image.url),
25-
options: .queryMemoryData,
26-
isAnimating: .constant(true)
27-
) {
28-
Color.randomColor
29-
}
25+
options: [.queryMemoryData, .progressiveLoad],
26+
isAnimating: .constant(true),
27+
placeholder: { Color.randomColor }
28+
)
3029
.onSuccess { _, data, _ in
3130
downloadedImage = data
3231
}
@@ -43,7 +42,6 @@ struct GiffyGridRow: View {
4342
.onTapGesture {
4443
onTapRow?(giphy)
4544
}
46-
.showGiphyMenu(URL(string: giphy.url), data: downloadedImage)
4745
}
4846
}
4947
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)