Skip to content

Commit

Permalink
[동주] TabView 내 로딩 Lottie 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yoondj98 committed Aug 11, 2024
1 parent 219d86b commit b9a9ed2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
087B50A42C492100005BF53C /* RoundedCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 087B50A32C492100005BF53C /* RoundedCorner.swift */; };
088DFC4E2C52489400469FD1 /* loading.lottie in Resources */ = {isa = PBXBuildFile; fileRef = 088DFC4D2C52489400469FD1 /* loading.lottie */; };
088DFC512C524A9600469FD1 /* DotLottie in Frameworks */ = {isa = PBXBuildFile; productRef = 088DFC502C524A9600469FD1 /* DotLottie */; };
08A793AB2C623933004A1FEB /* addList.lottie in Resources */ = {isa = PBXBuildFile; fileRef = 08A793AA2C62392F004A1FEB /* addList.lottie */; };
08C737A92C4C06A000FA93A4 /* DoubleSidedBackgroundScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C737A82C4C06A000FA93A4 /* DoubleSidedBackgroundScrollView.swift */; };
08C737AB2C4C0E7200FA93A4 /* SlidingTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C737AA2C4C0E7200FA93A4 /* SlidingTabView.swift */; };
08C737AD2C4CA2B400FA93A4 /* FrequentlyAteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C737AC2C4CA2B400FA93A4 /* FrequentlyAteView.swift */; };
Expand All @@ -45,6 +46,8 @@
08C737F72C52277E00FA93A4 /* ModelData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C737F62C52277E00FA93A4 /* ModelData.swift */; };
08C737F92C52297600FA93A4 /* FoodRankCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C737F82C52297600FA93A4 /* FoodRankCell.swift */; };
08CC18702C492BA8007EF06E /* SearchNavigatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08CC186F2C492BA8007EF06E /* SearchNavigatorView.swift */; };
08EAA4F52C58DF7C00115508 /* FavoriteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08EAA4F42C58DF7C00115508 /* FavoriteView.swift */; };
08EAA4F72C58DF8500115508 /* DirectRegisterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08EAA4F62C58DF8500115508 /* DirectRegisterView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -79,6 +82,7 @@
087B509F2C4906B4005BF53C /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = "<group>"; };
087B50A32C492100005BF53C /* RoundedCorner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedCorner.swift; sourceTree = "<group>"; };
088DFC4D2C52489400469FD1 /* loading.lottie */ = {isa = PBXFileReference; lastKnownFileType = file; path = loading.lottie; sourceTree = "<group>"; };
08A793AA2C62392F004A1FEB /* addList.lottie */ = {isa = PBXFileReference; lastKnownFileType = file; path = addList.lottie; sourceTree = "<group>"; };
08C737A82C4C06A000FA93A4 /* DoubleSidedBackgroundScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleSidedBackgroundScrollView.swift; sourceTree = "<group>"; };
08C737AA2C4C0E7200FA93A4 /* SlidingTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlidingTabView.swift; sourceTree = "<group>"; };
08C737AC2C4CA2B400FA93A4 /* FrequentlyAteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrequentlyAteView.swift; sourceTree = "<group>"; };
Expand All @@ -87,6 +91,8 @@
08C737F62C52277E00FA93A4 /* ModelData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelData.swift; sourceTree = "<group>"; };
08C737F82C52297600FA93A4 /* FoodRankCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodRankCell.swift; sourceTree = "<group>"; };
08CC186F2C492BA8007EF06E /* SearchNavigatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchNavigatorView.swift; sourceTree = "<group>"; };
08EAA4F42C58DF7C00115508 /* FavoriteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteView.swift; sourceTree = "<group>"; };
08EAA4F62C58DF8500115508 /* DirectRegisterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectRegisterView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -182,6 +188,7 @@
082D45222C4582F9007AD8FB /* Fonts */,
082D450D2C458093007AD8FB /* Assets.xcassets */,
088DFC4D2C52489400469FD1 /* loading.lottie */,
08A793AA2C62392F004A1FEB /* addList.lottie */,
);
path = Resource;
sourceTree = "<group>";
Expand Down Expand Up @@ -287,10 +294,10 @@
082D45552C468E14007AD8FB /* Record */ = {
isa = PBXGroup;
children = (
08EAA4F32C58DF4900115508 /* RecordTabmenuView */,
082D45562C468E20007AD8FB /* RecordView.swift */,
08CC186F2C492BA8007EF06E /* SearchNavigatorView.swift */,
08C737AA2C4C0E7200FA93A4 /* SlidingTabView.swift */,
08C737AC2C4CA2B400FA93A4 /* FrequentlyAteView.swift */,
08C737F82C52297600FA93A4 /* FoodRankCell.swift */,
08621D232C57EC2F00E26998 /* UserSexFilterView.swift */,
08621D262C57FDF400E26998 /* RecordButtonView.swift */,
Expand All @@ -306,6 +313,16 @@
path = Component;
sourceTree = "<group>";
};
08EAA4F32C58DF4900115508 /* RecordTabmenuView */ = {
isa = PBXGroup;
children = (
08C737AC2C4CA2B400FA93A4 /* FrequentlyAteView.swift */,
08EAA4F42C58DF7C00115508 /* FavoriteView.swift */,
08EAA4F62C58DF8500115508 /* DirectRegisterView.swift */,
);
path = RecordTabmenuView;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -379,6 +396,7 @@
082D452E2C458325007AD8FB /* Pretendard-Bold.otf in Resources */,
082D452D2C458325007AD8FB /* Pretendard-Light.otf in Resources */,
082D45112C458093007AD8FB /* Preview Assets.xcassets in Resources */,
08A793AB2C623933004A1FEB /* addList.lottie in Resources */,
082D45312C458325007AD8FB /* Pretendard-Regular.otf in Resources */,
082D452F2C458325007AD8FB /* Pretendard-Black.otf in Resources */,
082D453D2C458DE2007AD8FB /* food_list_with_rank.json in Resources */,
Expand Down Expand Up @@ -408,8 +426,10 @@
082D450C2C458092007AD8FB /* MyHealthView.swift in Sources */,
082D454E2C468B21007AD8FB /* ContentView.swift in Sources */,
08C737AF2C4CA2D900FA93A4 /* ChipButton.swift in Sources */,
08EAA4F72C58DF8500115508 /* DirectRegisterView.swift in Sources */,
082D450A2C458092007AD8FB /* PillyzeApp.swift in Sources */,
08C737AB2C4C0E7200FA93A4 /* SlidingTabView.swift in Sources */,
08EAA4F52C58DF7C00115508 /* FavoriteView.swift in Sources */,
082D45542C468B96007AD8FB /* NutrientsView.swift in Sources */,
082D454A2C467F0D007AD8FB /* MyHealthSectionStack.swift in Sources */,
08C737A92C4C06A000FA93A4 /* DoubleSidedBackgroundScrollView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ struct RecordView: View {
@State private var selectionTab: Int = RecordTabMenu.frequentlyAte.selectedTab
@State private var filterElement: FilteringMenu = .all
@State private var userSex: UserSex = .male
@State private var isLottieAnimationShown = false
@State private var selectedFoods: [RankingFood] = []
@State private var isLoadingLottieShown: Bool = true

@Binding var isRecordSheetShown: Bool

var lottieAnimation = DotLottieAnimation(fileName: "loading", config: AnimationConfig(autoplay: true, loop: false))

var body: some View {
VStack {
VStack(spacing: 0) {
SearchNavigatorView(isRecordSheetShown: $isRecordSheetShown)
.padding(20)

Expand Down Expand Up @@ -101,29 +106,47 @@ struct RecordView: View {
}
Spacer()
}
.padding(.vertical, 11)

Spacer()
.frame(height: 23)
UserSexFilterView(userSex: $userSex)

ScrollView {
ForEach(Array(modelData.rankingFoods.enumerated()),
id: \.element.id) { index, food in
FoodRankCell(food: food, index: index + 1)
Divider()
ZStack {
switch menu {
case .frequentlyAte:
FrequentlyAteView(selectedFoods: $selectedFoods,
isLottieAnimationShown: $isLottieAnimationShown,
userSex: $userSex)
case .favorite:
FavoriteView()
case .directRegister:
DirectRegisterView()
}
if isLoadingLottieShown {
ZStack {
Color.white
.frame(maxWidth: .infinity, maxHeight: .infinity)
lottieAnimation.view()
.frame(width: 100, height: 100)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
isLoadingLottieShown = false
}
}
}
}
}
.scrollIndicators(.hidden)
Spacer()

}
.padding(.horizontal, 20)
.tag(menu.selectedTab)
.tag(index)
}
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .automatic))
.onChange(of: selectionTab) { oldValue, newValue in
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
.onChange(of: selectionTab) { _, newValue in
self.selectionTab = newValue
}
RecordButtonView()
RecordButtonView(isLottieAnimationShown: $isLottieAnimationShown,
selectedFoods: $selectedFoods)
}

}
Expand Down

0 comments on commit b9a9ed2

Please sign in to comment.