Moved the definition of the toolbar from the BrowseView view to its own file.
This commit is contained in:
parent
b6202c76af
commit
b81d846aa8
@ -19,6 +19,7 @@
|
|||||||
02CE5557293B134200730DC9 /* Image+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5556293B134200730DC9 /* Image+Helpers.swift */; };
|
02CE5557293B134200730DC9 /* Image+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5556293B134200730DC9 /* Image+Helpers.swift */; };
|
||||||
02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5558293B1AB600730DC9 /* Text+Helpers.swift */; };
|
02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE5558293B1AB600730DC9 /* Text+Helpers.swift */; };
|
||||||
02CE555B293B1D8400730DC9 /* BrowseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE555A293B1D8400730DC9 /* BrowseView.swift */; };
|
02CE555B293B1D8400730DC9 /* BrowseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE555A293B1D8400730DC9 /* BrowseView.swift */; };
|
||||||
|
02CE555E293B34E900730DC9 /* BrowseToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CE555D293B34E900730DC9 /* BrowseToolbar.swift */; };
|
||||||
02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FFFD7A29395DD200306533 /* String+Constants.swift */; };
|
02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FFFD7A29395DD200306533 /* String+Constants.swift */; };
|
||||||
4694AAA0293A7C8800D54903 /* Modules in Frameworks */ = {isa = PBXBuildFile; productRef = 4694AA9F293A7C8800D54903 /* Modules */; };
|
4694AAA0293A7C8800D54903 /* Modules in Frameworks */ = {isa = PBXBuildFile; productRef = 4694AA9F293A7C8800D54903 /* Modules */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
@ -57,6 +58,7 @@
|
|||||||
02CE5556293B134200730DC9 /* Image+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Image+Helpers.swift"; sourceTree = "<group>"; };
|
02CE5556293B134200730DC9 /* Image+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Image+Helpers.swift"; sourceTree = "<group>"; };
|
||||||
02CE5558293B1AB600730DC9 /* Text+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+Helpers.swift"; sourceTree = "<group>"; };
|
02CE5558293B1AB600730DC9 /* Text+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+Helpers.swift"; sourceTree = "<group>"; };
|
||||||
02CE555A293B1D8400730DC9 /* BrowseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseView.swift; sourceTree = "<group>"; };
|
02CE555A293B1D8400730DC9 /* BrowseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseView.swift; sourceTree = "<group>"; };
|
||||||
|
02CE555D293B34E900730DC9 /* BrowseToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseToolbar.swift; sourceTree = "<group>"; };
|
||||||
02FFFD7A29395DD200306533 /* String+Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Constants.swift"; sourceTree = "<group>"; };
|
02FFFD7A29395DD200306533 /* String+Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Constants.swift"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -151,6 +153,7 @@
|
|||||||
children = (
|
children = (
|
||||||
02CE5555293B131D00730DC9 /* Extensions */,
|
02CE5555293B131D00730DC9 /* Extensions */,
|
||||||
02B334E6293A93CE00C45E31 /* Components */,
|
02B334E6293A93CE00C45E31 /* Components */,
|
||||||
|
02CE555C293B34CF00730DC9 /* Toolbars */,
|
||||||
02B334E5293A93C400C45E31 /* Views */,
|
02B334E5293A93C400C45E31 /* Views */,
|
||||||
);
|
);
|
||||||
path = Browse;
|
path = Browse;
|
||||||
@ -182,6 +185,14 @@
|
|||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
02CE555C293B34CF00730DC9 /* Toolbars */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
02CE555D293B34E900730DC9 /* BrowseToolbar.swift */,
|
||||||
|
);
|
||||||
|
path = Toolbars;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
02FFFD7929395DBF00306533 /* Extensions */ = {
|
02FFFD7929395DBF00306533 /* Extensions */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -339,6 +350,7 @@
|
|||||||
02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */,
|
02CE5559293B1AB600730DC9 /* Text+Helpers.swift in Sources */,
|
||||||
02AE64EF29363DBF005A4AF3 /* BeRealApp.swift in Sources */,
|
02AE64EF29363DBF005A4AF3 /* BeRealApp.swift in Sources */,
|
||||||
02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */,
|
02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */,
|
||||||
|
02CE555E293B34E900730DC9 /* BrowseToolbar.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
62
BeReal/Browse/Toolbars/BrowseToolbar.swift
Normal file
62
BeReal/Browse/Toolbars/BrowseToolbar.swift
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
//
|
||||||
|
// BrowseToolbar.swift
|
||||||
|
// BeReal
|
||||||
|
//
|
||||||
|
// Created by Javier Cicchelli on 03/12/2022.
|
||||||
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct BrowseToolbar: ToolbarContent {
|
||||||
|
var body: some ToolbarContent {
|
||||||
|
ToolbarItem(placement: .primaryAction) {
|
||||||
|
Menu {
|
||||||
|
Button {
|
||||||
|
// TODO: Implement the creation of a new folder.
|
||||||
|
} label: {
|
||||||
|
Label {
|
||||||
|
Text("Create a new folder")
|
||||||
|
} icon: {
|
||||||
|
Image.newFolder
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
// TODO: Implement the upload of a file from the device to the API.
|
||||||
|
} label: {
|
||||||
|
Label {
|
||||||
|
Text("Upload a file")
|
||||||
|
} icon: {
|
||||||
|
Image.newFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label {
|
||||||
|
Text("Add file and/or folder")
|
||||||
|
} icon: {
|
||||||
|
Image.add
|
||||||
|
.foregroundColor(.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
|
Button {
|
||||||
|
// TODO: Implement the show of the user profile.
|
||||||
|
} label: {
|
||||||
|
Image.profile
|
||||||
|
.foregroundColor(.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Image+Constants
|
||||||
|
|
||||||
|
private extension Image {
|
||||||
|
static let profile = Image(systemName: "person.crop.circle.fill")
|
||||||
|
static let add = Image(systemName: "plus.circle.fill")
|
||||||
|
static let newFolder = Image(systemName: "folder.badge.plus")
|
||||||
|
static let newFile = Image(systemName: "doc.badge.plus")
|
||||||
|
}
|
@ -64,7 +64,7 @@ struct BrowseView: View {
|
|||||||
allowsFullSwipe: true
|
allowsFullSwipe: true
|
||||||
) {
|
) {
|
||||||
Button {
|
Button {
|
||||||
// ...
|
// TODO: Implement the removal of the item from the API.
|
||||||
} label: {
|
} label: {
|
||||||
Label {
|
Label {
|
||||||
Text("Delete item")
|
Text("Delete item")
|
||||||
@ -76,7 +76,7 @@ struct BrowseView: View {
|
|||||||
|
|
||||||
// TODO: allow download only if item is a file.
|
// TODO: allow download only if item is a file.
|
||||||
Button {
|
Button {
|
||||||
// ...
|
// TODO: Implement the downloading of the data of the item from the API into the device.
|
||||||
} label: {
|
} label: {
|
||||||
Label {
|
Label {
|
||||||
Text("Download item")
|
Text("Download item")
|
||||||
@ -91,45 +91,7 @@ struct BrowseView: View {
|
|||||||
.background(Color.red)
|
.background(Color.red)
|
||||||
.navigationTitle("Folder name")
|
.navigationTitle("Folder name")
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .primaryAction) {
|
BrowseToolbar()
|
||||||
Menu {
|
|
||||||
Button {
|
|
||||||
// TODO: Implement the creation of a new folder.
|
|
||||||
} label: {
|
|
||||||
Label {
|
|
||||||
Text("Create a new folder")
|
|
||||||
} icon: {
|
|
||||||
Image.newFolder
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
// TODO: Implement the upload of a file from the device to the API.
|
|
||||||
} label: {
|
|
||||||
Label {
|
|
||||||
Text("Upload a file")
|
|
||||||
} icon: {
|
|
||||||
Image.newFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Label {
|
|
||||||
Text("Add file and/or folder")
|
|
||||||
} icon: {
|
|
||||||
Image.add
|
|
||||||
.foregroundColor(.red)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
|
||||||
Button {
|
|
||||||
// TODO: Implement the show of the user profile.
|
|
||||||
} label: {
|
|
||||||
Image.profile
|
|
||||||
.foregroundColor(.red)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,10 +99,6 @@ struct BrowseView: View {
|
|||||||
// MARK: - Image+Constants
|
// MARK: - Image+Constants
|
||||||
|
|
||||||
private extension Image {
|
private extension Image {
|
||||||
static let profile = Image(systemName: "person.crop.circle.fill")
|
|
||||||
static let add = Image(systemName: "plus.circle.fill")
|
|
||||||
static let newFolder = Image(systemName: "folder.badge.plus")
|
|
||||||
static let newFile = Image(systemName: "doc.badge.plus")
|
|
||||||
static let trash = Image(systemName: "trash")
|
static let trash = Image(systemName: "trash")
|
||||||
static let download = Image(systemName: "arrow.down.doc")
|
static let download = Image(systemName: "arrow.down.doc")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user