-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/empty-state' into develop
This resolves #68 Signed-off-by: Peter Friese <[email protected]>
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
code/frontend/MakeItSo/MakeItSo.xcodeproj/xcshareddata/xcschemes/MakeItSo (iOS).xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1320" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "88FEECD027275ABD00ED368C" | ||
BuildableName = "MakeItSo.app" | ||
BlueprintName = "MakeItSo (iOS)" | ||
ReferencedContainer = "container:MakeItSo.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "88FEECD027275ABD00ED368C" | ||
BuildableName = "MakeItSo.app" | ||
BlueprintName = "MakeItSo (iOS)" | ||
ReferencedContainer = "container:MakeItSo.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "88FEECD027275ABD00ED368C" | ||
BuildableName = "MakeItSo.app" | ||
BlueprintName = "MakeItSo (iOS)" | ||
ReferencedContainer = "container:MakeItSo.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
57 changes: 57 additions & 0 deletions
57
code/frontend/MakeItSo/Shared/Common/Views/EmptyStateView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// EmptyStateView.swift | ||
// MakeItSo (iOS) | ||
// | ||
// Created by Peter Friese on 12.11.21. | ||
// Copyright © 2021 Google LLC. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http:https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import SwiftUI | ||
|
||
extension View { | ||
func debug() -> Self { | ||
print(Mirror(reflecting: self).subjectType) | ||
return self | ||
} | ||
} | ||
|
||
struct EmptyStateViewModifier<EmptyContent>: ViewModifier where EmptyContent: View { | ||
var isEmpty: Bool | ||
let emptyContent: () -> EmptyContent | ||
|
||
func body(content: Content) -> some View { | ||
if isEmpty { | ||
emptyContent() | ||
} | ||
else { | ||
content | ||
} | ||
} | ||
} | ||
|
||
extension View { | ||
func emptyState<EmptyContent>(_ isEmpty: Bool, | ||
emptyContent: @escaping () -> EmptyContent) -> some View where EmptyContent: View { | ||
modifier(EmptyStateViewModifier(isEmpty: isEmpty, emptyContent: emptyContent)) | ||
} | ||
} | ||
|
||
struct EmptyStateView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
Label("Content", systemImage: "heart") | ||
.emptyState(true) { | ||
Text("We don't have any content, sorry 😔") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters