Initial commit, first views

This commit is contained in:
2023-01-12 23:07:37 +01:00
parent 830cb8785a
commit f87c712e41
19 changed files with 319 additions and 78 deletions
+41
View File
@@ -0,0 +1,41 @@
//
// ContentView.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
Dashboard()
// Badge can show e.g. number of notifications or new posts
//.badge(2)
.tabItem {
Label("dashboard".localized(tableName: "General"), systemImage: "house.fill")
}
People()
.tabItem {
Label("people".localized(tableName: "General"), systemImage: "person.3.fill")
}
Spaces()
.tabItem {
Label("spaces".localized(tableName: "General"), systemImage: "circle.circle")
}
Profile()
.tabItem{
Label("profile".localized(tableName: "General"), systemImage: "person")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.preferredColorScheme(.dark)
}
}
@@ -10,8 +10,8 @@ import SwiftUI
@main
struct FirebonkApp: App {
var body: some Scene {
DocumentGroup(newDocument: FirebonkDocument()) { file in
ContentView(document: file.$document)
WindowGroup {
ContentView()
}
}
}
-22
View File
@@ -1,22 +0,0 @@
//
// ContentView.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct ContentView: View {
@Binding var document: FirebonkDocument
var body: some View {
TextEditor(text: $document.text)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(document: .constant(FirebonkDocument()))
}
}
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.example.plain-text</string>
</array>
<key>NSUbiquitousDocumentUserActivityType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).example-document</string>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>Example Text</string>
<key>UTTypeIdentifier</key>
<string>com.example.plain-text</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>exampletext</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
+20
View File
@@ -0,0 +1,20 @@
//
// Dashboard.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct Dashboard: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct Dashboard_Previews: PreviewProvider {
static var previews: some View {
Dashboard()
}
}
+20
View File
@@ -0,0 +1,20 @@
//
// People.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct People: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct People_Previews: PreviewProvider {
static var previews: some View {
People()
}
}
+20
View File
@@ -0,0 +1,20 @@
//
// Profile.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct Profile: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct Profile_Previews: PreviewProvider {
static var previews: some View {
Profile()
}
}
+20
View File
@@ -0,0 +1,20 @@
//
// Spaces.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import SwiftUI
struct Spaces: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct Spaces_Previews: PreviewProvider {
static var previews: some View {
Spaces()
}
}
+30
View File
@@ -0,0 +1,30 @@
//
// Localizer.swift
// Firebonk
//
// Created by Patrick Müller on 12.01.23.
//
import Foundation
private class Localizer {
static let sharedInstance = Localizer()
func localize(string: String, tableName: String, plural: Bool) -> String {
var localizedString: String
if plural{
localizedString = NSLocalizedString(string, tableName: tableName, value:"**\(self)**", comment: "plural")
}else{
localizedString = NSLocalizedString(string, tableName: tableName, value:"**\(self)**", comment: "")
}
return localizedString
}
}
extension String {
func localized(tableName: String = "Localizable", plural: Bool = false) -> String {
return Localizer.sharedInstance.localize(string: self, tableName: tableName, plural: plural)
}
}
+13
View File
@@ -0,0 +1,13 @@
/*
General.strings
Firebonk
Created by Patrick Müller on 12.01.23.
*/
/* Tab Names */
"dashboard" = "Dashboard";
"people" = "Personen";
"spaces" = "Spaces";
"profile" = "Profil";
@@ -0,0 +1,7 @@
/*
Localizable.strings
Firebonk
Created by Patrick Müller on 12.01.23.
*/
+13
View File
@@ -0,0 +1,13 @@
/*
General.strings
Firebonk
Created by Patrick Müller on 12.01.23.
*/
/* Tab Names */
"dashboard" = "Dashboard";
"people" = "People";
"spaces" = "Spaces";
"profile" = "Profile";
@@ -0,0 +1,7 @@
/*
Localizable.strings
Firebonk
Created by Patrick Müller on 12.01.23.
*/