Skip to content

Commit

Permalink
カスタムタブバーに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
boardguy1024 committed Oct 14, 2023
1 parent 7e3f67f commit 361b715
Show file tree
Hide file tree
Showing 39 changed files with 319 additions and 85 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "export-document.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Bookmarks.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions TwitterSwiftUI/Assets.xcassets/Twitter Icon Set/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Home.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Light.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Lists.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Logo.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Message.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Moments.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "monetization.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Notifications.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Profile.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "shopping-cart.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "QR.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Search.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Sparkles.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Topics.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "xlogo.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions TwitterSwiftUI/Core/Components/PagerTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct PagerTabView<Tab: View, Content: View>: View {

@Binding var selectedTab: Int


init(selected: Binding<Int>,
tabs: [Tab],
@ViewBuilder content: @escaping () -> Content) {
Expand Down Expand Up @@ -52,6 +53,8 @@ struct PagerTabView<Tab: View, Content: View>: View {
}
}
.onChange(of: offset) { _ in


// SwipeでPagingする時のみ、UnderlineViewを移動させる
if isScrolling {
underlineViewOffset = offset / CGFloat(tabs.count)
Expand Down Expand Up @@ -161,9 +164,7 @@ fileprivate struct OffsetPageTabView<Content: View>: UIViewRepresentable {
scrollView.isPagingEnabled = true
scrollView.showsVerticalScrollIndicator = false
scrollView.showsHorizontalScrollIndicator = false

scrollView.delegate = context.coordinator

return scrollView
}

Expand All @@ -188,7 +189,8 @@ extension OffsetPageTabView {
}

func scrollViewDidScroll(_ scrollView: UIScrollView) {
parent.offset = scrollView.contentOffset.x
let offsetX = scrollView.contentOffset.x
parent.offset = offsetX
parent.isScrolling = (scrollView.isDragging || scrollView.isTracking || scrollView.isDecelerating)
}

Expand Down
47 changes: 16 additions & 31 deletions TwitterSwiftUI/Core/FeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,23 @@ struct FeedView: View {

headerView

ZStack(alignment: .bottomTrailing) {

PagerTabView(selected: $viewModel.currentTab, tabs:
[
TabLabel(type: .recommend),
TabLabel(type: .following),
]) {
ForEach(FeedTabFilter.allCases) { type in
FeedTabListView()
.environmentObject(self.viewModel)
.frame(width: UIScreen.main.bounds.width)
}
}
.refreshable {
Task {
try await viewModel.fetchTweets()
}
}
Button {
showNewTweetView.toggle()
} label: {
Image(systemName: "square.and.pencil")
.font(.title2)
.foregroundColor(.white)
PagerTabView(
selected: $viewModel.currentTab, tabs:
[
TabLabel(type: .recommend),
TabLabel(type: .following),
]
) {
ForEach(FeedTabFilter.allCases) { type in
FeedTabListView()
.environmentObject(self.viewModel)
.frame(width: UIScreen.main.bounds.width)
}
}
.refreshable {
Task {
try await viewModel.fetchTweets()
}
.background(
Circle()
.fill(Color(.systemBlue))
.frame(width: 54, height: 54)
)
.padding(.trailing, 32)
.padding(.bottom, 32)
}
}
.toolbar(.hidden, for: .navigationBar)
Expand Down
Loading

0 comments on commit 361b715

Please sign in to comment.