damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | LICENSE

commit 180faddf895774083eaf53353d5234d0c0b6d0c0
parent 084d699cfc20911f673745c09db4d9cd60f8fd3c
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 20 May 2022 16:06:13 -0700

extract carousel view

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++++
Adamus/Views/CarouselView.swift | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdamus/Views/SetupView.swift | 51---------------------------------------------------
3 files changed, 64 insertions(+), 51 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 4C0A3F93280F66F5000448DE /* ReplyMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A3F92280F66F5000448DE /* ReplyMap.swift */; }; 4C0A3F95280F6C78000448DE /* ReplyQuoteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A3F94280F6C78000448DE /* ReplyQuoteView.swift */; }; 4C0A3F97280F8E02000448DE /* ThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A3F96280F8E02000448DE /* ThreadView.swift */; }; + 4C285C8228385570008A31F1 /* CarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C285C8128385570008A31F1 /* CarouselView.swift */; }; 4C363A8428233689006E126D /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C363A8328233689006E126D /* Parser.swift */; }; 4C363A8628234FDE006E126D /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C363A8528234FDE006E126D /* ImageCache.swift */; }; 4C363A8828236948006E126D /* BlocksView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C363A8728236948006E126D /* BlocksView.swift */; }; @@ -103,6 +104,7 @@ 4C0A3F92280F66F5000448DE /* ReplyMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplyMap.swift; sourceTree = "<group>"; }; 4C0A3F94280F6C78000448DE /* ReplyQuoteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplyQuoteView.swift; sourceTree = "<group>"; }; 4C0A3F96280F8E02000448DE /* ThreadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadView.swift; sourceTree = "<group>"; }; + 4C285C8128385570008A31F1 /* CarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselView.swift; sourceTree = "<group>"; }; 4C363A8328233689006E126D /* Parser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Parser.swift; sourceTree = "<group>"; }; 4C363A8528234FDE006E126D /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; }; 4C363A8728236948006E126D /* BlocksView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlocksView.swift; sourceTree = "<group>"; }; @@ -249,6 +251,7 @@ 4C3AC7A02835A81400E1F516 /* SetupView.swift */, 4C3AC7A42836987600E1F516 /* MainTabView.swift */, 4C3AC7A628369BA200E1F516 /* SearchHomeView.swift */, + 4C285C8128385570008A31F1 /* CarouselView.swift */, ); path = Views; sourceTree = "<group>"; @@ -522,6 +525,7 @@ 4C3BEFDC281DCE6100B3DE84 /* Liked.swift in Sources */, 4C75EFB128049D510006080F /* NostrResponse.swift in Sources */, 4CEE2AF7280B2DEA00AB5EEF /* ProfileName.swift in Sources */, + 4C285C8228385570008A31F1 /* CarouselView.swift in Sources */, 4CEE2B02280B39E800AB5EEF /* EventActionBar.swift in Sources */, 4C3BEFE0281DE1ED00B3DE84 /* DamusState.swift in Sources */, 4C0A3F8F280F640A000448DE /* ThreadModel.swift in Sources */, diff --git a/damus/Views/CarouselView.swift b/damus/Views/CarouselView.swift @@ -0,0 +1,60 @@ +// +// CarouselView.swift +// damus +// +// Created by William Casarin on 2022-05-20. +// + +import SwiftUI + +struct CarouselItem: Identifiable { + let image: Image + let text: Text + + let id = UUID().uuidString +} + +let carousel_items = [ + CarouselItem(image: Image("digital-nomad"), text: Text("Welcome to the social network \(Text("you").italic()) control.")), + CarouselItem(image: Image("encrypted-message"), + text: Text("\(Text("Encrypted").bold()). End-to-End encrypted private messaging. Keep Big Tech out of your DMs")), + CarouselItem(image: Image("undercover"), + text: Text("\(Text("Private").bold()). Creating an account doesn't require a phone number, email or name. Get started right away with zero friction.")), + CarouselItem(image: Image("bitcoin-p2p"), + text: Text("\(Text("Earn Money").bold()). Tip your friend's posts and stack sats with Bitcoin⚡️, the native currency of the internet.")) +] + +struct CarouselView: View { + var body: some View { + TabView { + ForEach(carousel_items) { item in + CarouselItemView(item: item) + .tabItem { + Text(item.id) + } + } + } + .tabViewStyle(PageTabViewStyle()) + } +} + +func CarouselText(_ txt: String) -> some View { + return Text(txt) +} + +struct CarouselItemView: View { + let item: CarouselItem + + var body: some View { + VStack(spacing: 30) { + item.image + .resizable() + .frame(width: 120, height: 120) + item.text + .multilineTextAlignment(.center) + .font(.title2) + .foregroundColor(Color.white) + .padding([.leading,.trailing], 50.0) + } + } +} diff --git a/damus/Views/SetupView.swift b/damus/Views/SetupView.swift @@ -64,57 +64,6 @@ struct SetupView: View { } } -func CarouselText(_ txt: String) -> some View { - return Text(txt) -} - -struct CarouselItem: Identifiable { - let image: Image - let text: Text - - let id = UUID().uuidString -} - -struct CarouselItemView: View { - let item: CarouselItem - - var body: some View { - VStack(spacing: 30) { - item.image - .resizable() - .frame(width: 120, height: 120) - item.text - .multilineTextAlignment(.center) - .font(.title2) - .foregroundColor(Color.white) - .padding([.leading,.trailing], 50.0) - } - } -} - -let carousel_items = [ - CarouselItem(image: Image("digital-nomad"), text: Text("Welcome to the social network \(Text("you").italic()) control.")), - CarouselItem(image: Image("encrypted-message"), - text: Text("\(Text("Encrypted").bold()). End-to-End encrypted private messaging. Keep Big Tech out of your DMs")), - CarouselItem(image: Image("undercover"), - text: Text("\(Text("Private").bold()). Creating an account doesn't require a phone number, email or name. Get started right away with zero friction.")), - CarouselItem(image: Image("bitcoin-p2p"), - text: Text("\(Text("Earn Money").bold()). Tip your friend's posts and stack sats with Bitcoin⚡️, the native currency of the internet.")) -] - -struct CarouselView: View { - var body: some View { - TabView { - ForEach(carousel_items) { item in - CarouselItemView(item: item) - .tabItem { - Text(item.image) - } - } - } - .tabViewStyle(PageTabViewStyle()) - } -} struct SetupView_Previews: PreviewProvider { static var previews: some View {