Skip to content

Commit

Permalink
Merge pull request #30 from xmartlabs/exampleChanges
Browse files Browse the repository at this point in the history
remove navbaritem from model
  • Loading branch information
Martin Barreto authored Aug 2, 2021
2 parents 20eeaba + 63b2bf6 commit 25cb658
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class GalleryModel: ObservableObject {
var navBarItem = InstagramNavBarItem(imageName: "gallery")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class LikedModel: ObservableObject {
var navBarItem = InstagramNavBarItem(imageName: "liked")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class ListModel: ObservableObject {
var navBarItem = InstagramNavBarItem(imageName: "list")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class SavedModel: ObservableObject {
var navBarItem = InstagramNavBarItem(imageName: "saved")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class LikesModel: ObservableObject {
var navBarItem = TwitterNavBarItem(title: "Likes")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class MediaModel: ObservableObject {
var navBarItem = TwitterNavBarItem(title: "Media")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation

class TweetsModel: ObservableObject {
var navBarItem = TwitterNavBarItem(title: "Tweets")

var posts: [Post] {
PostsFactory.shared.posts
Expand Down
8 changes: 4 additions & 4 deletions Example/Shared/InstagramView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct InstagramView: View {
var body: some View {
PagerTabStripView(selection: $selection) {
PostsList(isLoading: $galleryModel.isLoading, items: galleryModel.posts).pagerTabItem {
galleryModel.navBarItem
InstagramNavBarItem(imageName: "gallery")
}.onPageAppear {
galleryModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand All @@ -29,7 +29,7 @@ struct InstagramView: View {
}

PostsList(isLoading: $listModel.isLoading, items: listModel.posts, withDescription: false).pagerTabItem {
listModel.navBarItem
InstagramNavBarItem(imageName: "list")
}.onPageAppear {
listModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand All @@ -38,7 +38,7 @@ struct InstagramView: View {
}

PostsList(isLoading: $likedModel.isLoading, items: likedModel.posts).pagerTabItem {
likedModel.navBarItem
InstagramNavBarItem(imageName: "liked")
}.onPageAppear {
likedModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand All @@ -47,7 +47,7 @@ struct InstagramView: View {
}

PostsList(isLoading: $savedModel.isLoading, items: savedModel.posts, withDescription: false).pagerTabItem {
savedModel.navBarItem
InstagramNavBarItem(imageName: "saved")
}.onPageAppear {
savedModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand Down
6 changes: 3 additions & 3 deletions Example/Shared/TwitterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct TwitterView: View {
var body: some View {
PagerTabStripView(selection: $selection) {
PostsList(isLoading: $tweetsModel.isLoading, items: tweetsModel.posts).pagerTabItem {
tweetsModel.navBarItem
TwitterNavBarItem(title: "Tweets")
}.onPageAppear {
tweetsModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand All @@ -27,7 +27,7 @@ struct TwitterView: View {
}

PostsList(isLoading: $mediaModel.isLoading, items: mediaModel.posts).pagerTabItem {
mediaModel.navBarItem
TwitterNavBarItem(title: "Media")
}.onPageAppear {
mediaModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand All @@ -36,7 +36,7 @@ struct TwitterView: View {
}

PostsList(isLoading: $likesModel.isLoading, items: likesModel.posts, withDescription: false).pagerTabItem {
likesModel.navBarItem
TwitterNavBarItem(title: "Likes")
}.onPageAppear {
likesModel.isLoading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Expand Down

0 comments on commit 25cb658

Please sign in to comment.