From f73cfdd6372e5639a2690b5181ba76238b477605 Mon Sep 17 00:00:00 2001 From: k3y0708 Date: Mon, 31 Mar 2025 23:46:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Add=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wallet.xcodeproj/project.pbxproj | 20 +++++++++ Wallet/ContentView.swift | 37 ++++++++++------- Wallet/Views/Booking.swift | 70 ++++++++++++++++++++++++++++++++ Wallet/Views/Home.swift | 27 ++++++++++++ Wallet/Views/Profile.swift | 16 ++++++++ 5 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 Wallet/Views/Booking.swift create mode 100644 Wallet/Views/Home.swift create mode 100644 Wallet/Views/Profile.swift diff --git a/Wallet.xcodeproj/project.pbxproj b/Wallet.xcodeproj/project.pbxproj index 8dc0d9b..130313e 100644 --- a/Wallet.xcodeproj/project.pbxproj +++ b/Wallet.xcodeproj/project.pbxproj @@ -11,6 +11,9 @@ D49528BF2C296E8D009F6F54 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49528BE2C296E8D009F6F54 /* ContentView.swift */; }; D49528C12C296E8F009F6F54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D49528C02C296E8F009F6F54 /* Assets.xcassets */; }; D49528C52C296E8F009F6F54 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D49528C42C296E8F009F6F54 /* Preview Assets.xcassets */; }; + D49528CC2C297352009F6F54 /* Booking.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49528CB2C297352009F6F54 /* Booking.swift */; }; + D49528CE2C297429009F6F54 /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49528CD2C297429009F6F54 /* Profile.swift */; }; + D49528D12C2976BB009F6F54 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49528D02C2976BB009F6F54 /* Home.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -20,6 +23,9 @@ D49528C02C296E8F009F6F54 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D49528C22C296E8F009F6F54 /* Wallet.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Wallet.entitlements; sourceTree = ""; }; D49528C42C296E8F009F6F54 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + D49528CB2C297352009F6F54 /* Booking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Booking.swift; sourceTree = ""; }; + D49528CD2C297429009F6F54 /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = ""; }; + D49528D02C2976BB009F6F54 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -52,6 +58,7 @@ D49528BB2C296E8D009F6F54 /* Wallet */ = { isa = PBXGroup; children = ( + D49528CF2C29761E009F6F54 /* Views */, D49528BC2C296E8D009F6F54 /* WalletApp.swift */, D49528BE2C296E8D009F6F54 /* ContentView.swift */, D49528C02C296E8F009F6F54 /* Assets.xcassets */, @@ -69,6 +76,16 @@ path = "Preview Content"; sourceTree = ""; }; + D49528CF2C29761E009F6F54 /* Views */ = { + isa = PBXGroup; + children = ( + D49528CB2C297352009F6F54 /* Booking.swift */, + D49528CD2C297429009F6F54 /* Profile.swift */, + D49528D02C2976BB009F6F54 /* Home.swift */, + ); + path = Views; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -140,6 +157,9 @@ buildActionMask = 2147483647; files = ( D49528BF2C296E8D009F6F54 /* ContentView.swift in Sources */, + D49528CE2C297429009F6F54 /* Profile.swift in Sources */, + D49528D12C2976BB009F6F54 /* Home.swift in Sources */, + D49528CC2C297352009F6F54 /* Booking.swift in Sources */, D49528BD2C296E8D009F6F54 /* WalletApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Wallet/ContentView.swift b/Wallet/ContentView.swift index 0c10c65..c805a7a 100644 --- a/Wallet/ContentView.swift +++ b/Wallet/ContentView.swift @@ -1,24 +1,31 @@ -// -// ContentView.swift -// Wallet -// -// Created by Keyvan Atashfaraz on 24.06.24. -// - import SwiftUI struct ContentView: View { var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundStyle(.tint) - Text("Hello, world!") + TabView { + HomeView() + .tabItem { + Image(systemName: "house.fill") + Text("Home") + } + + BookingView() + .tabItem { + Image(systemName: "creditcard.fill") + Text("Bookings") + } + + ProfileView() + .tabItem { + Image(systemName: "person.fill") + Text("Profile") + } } - .padding() } } -#Preview { - ContentView() +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } } diff --git a/Wallet/Views/Booking.swift b/Wallet/Views/Booking.swift new file mode 100644 index 0000000..d67a063 --- /dev/null +++ b/Wallet/Views/Booking.swift @@ -0,0 +1,70 @@ +import SwiftUI + +public struct Booking: Identifiable { + public let id = UUID() + var sender_iban: String + var receiver_iban: String + var amount: Float +} + +struct BookingView: View { + @State public var bookings: [Booking] = [ + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78), + Booking(sender_iban: "My IBAN", receiver_iban: "Another IBAN", amount: 10.76), + Booking(sender_iban: "Another IBAN", receiver_iban: "My IBAN", amount: -3.78) + ] + + var body: some View { + NavigationView { + List { + ForEach(bookings) { booking in + HStack { + VStack(alignment: .leading, spacing: 8) { + HStack { + Image(systemName: "arrow.left") + Text(booking.sender_iban) + } + HStack { + Image(systemName: "arrow.right") + Text(booking.receiver_iban) + } + Text("\(booking.amount, specifier: "%.2f")") + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(5) + .background(Color.gray.opacity(0.15)) + .cornerRadius(10) + .padding(5) + } + .frame(maxWidth: .infinity) + .padding(.vertical, 4) + } + .listRowInsets(EdgeInsets()) + .listRowSeparator(.hidden) + } + .listStyle(PlainListStyle()) + .navigationTitle("Bookings") // Set navigation title + } + } +} + +struct BookingsView_Previews: PreviewProvider { + static var previews: some View { + BookingView() + } +} diff --git a/Wallet/Views/Home.swift b/Wallet/Views/Home.swift new file mode 100644 index 0000000..bbd201f --- /dev/null +++ b/Wallet/Views/Home.swift @@ -0,0 +1,27 @@ +import SwiftUI + +struct HomeView: View { + var body: some View { + NavigationView { + VStack { + Text("Hello, World!") + .padding() + NavigationLink(destination: SecondView()) { + Text("Go to Second View") + .foregroundColor(.blue) + .padding() + .background(Color.gray.opacity(0.2)) + .cornerRadius(8) + } + } + .navigationTitle("Home") + } + } +} + +struct SecondView: View { + var body: some View { + Text("This is the second view") + .navigationTitle("Second View") + } +} diff --git a/Wallet/Views/Profile.swift b/Wallet/Views/Profile.swift new file mode 100644 index 0000000..0819ea2 --- /dev/null +++ b/Wallet/Views/Profile.swift @@ -0,0 +1,16 @@ +// +// Profile.swift +// Wallet +// +// Created by Keyvan Atashfaraz on 24.06.24. +// + +import SwiftUI + +struct ProfileView: View { + var body: some View { + Text("Profile View") + .navigationTitle("Profile") + } +} +