Skip to content

Commit

Permalink
Add some preview macros (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-e authored Jun 17, 2024
1 parent 8b19cf6 commit 2a13a66
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ios/HackerNews/Screens/PostListScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,21 @@ struct PostListScreen: View {
}

}

#Preview {
PostListScreen(appState: AppViewModel())
}

#Preview("Loading") {
let appModel = AppViewModel()
appModel.authState = .loggedIn
appModel.storiesState = .loading
return PostListScreen(appState: appModel)
}

#Preview("Has posts") {
let appModel = AppViewModel()
appModel.authState = .loggedIn
appModel.storiesState = .loaded(stories: PreviewHelpers.makeFakeStories())
return PostListScreen(appState: appModel)
}

0 comments on commit 2a13a66

Please sign in to comment.