Skip to content

Commit

Permalink
use group preview for favorites view
Browse files Browse the repository at this point in the history
  • Loading branch information
paulz committed Jun 6, 2022
1 parent 7b77368 commit b9d7b35
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 19 deletions.
9 changes: 7 additions & 2 deletions Example/App/FavoriteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import PreviewGroup

/// https://www.hackingwithswift.com/articles/226/5-steps-to-better-swiftui-views
struct FavoriteView: View {
Expand All @@ -25,7 +26,11 @@ struct FavoriteView: View {

struct FavoriteView_Previews: PreviewProvider {
static var previews: some View {
FavoriteView()
.previewLayout(.sizeThatFits)
PreviewGroup {
FavoriteView()
FavoriteView()
.background(Color.white)
}
.previewLayout(.sizeThatFits)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 0 additions & 17 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
4B058458283A660A0027DAD5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B058457283A660A0027DAD5 /* Assets.xcassets */; };
4B05845B283A660A0027DAD5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B05845A283A660A0027DAD5 /* Preview Assets.xcassets */; };
4B058465283A660A0027DAD5 /* SnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B058464283A660A0027DAD5 /* SnapshotTests.swift */; };
4B058488283A67650027DAD5 /* SwiftUI_snapshot_test.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B058482283A67650027DAD5 /* SwiftUI_snapshot_test.framework */; };
4B058489283A67650027DAD5 /* SwiftUI_snapshot_test.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B058482283A67650027DAD5 /* SwiftUI_snapshot_test.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B058496283A67DE0027DAD5 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B058495283A67DD0027DAD5 /* XCTest.framework */; platformFilter = ios; };
4B0584A1283ADCD80027DAD5 /* maxColorDiff.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B05849E283ADCB00027DAD5 /* maxColorDiff.swift */; };
4B0584A2283ADCD80027DAD5 /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B05849F283ADCB00027DAD5 /* UIViewExtensions.swift */; };
Expand All @@ -34,13 +32,6 @@
remoteGlobalIDString = 4B05844F283A66090027DAD5;
remoteInfo = Example;
};
4B058486283A67650027DAD5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4B058448283A66080027DAD5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 4B058481283A67650027DAD5;
remoteInfo = "SwiftUI-snapshot-test";
};
4B9C5738284DE2DF001DE13A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4B058448283A66080027DAD5 /* Project object */;
Expand All @@ -64,7 +55,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
4B058489283A67650027DAD5 /* SwiftUI_snapshot_test.framework in Embed Frameworks */,
4B9C573B284DE2DF001DE13A /* PreviewGroup.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
Expand Down Expand Up @@ -107,7 +97,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4B058488283A67650027DAD5 /* SwiftUI_snapshot_test.framework in Frameworks */,
4B9C573A284DE2DF001DE13A /* PreviewGroup.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -250,7 +239,6 @@
buildRules = (
);
dependencies = (
4B058487283A67650027DAD5 /* PBXTargetDependency */,
4B9C5739284DE2DF001DE13A /* PBXTargetDependency */,
);
name = Example;
Expand Down Expand Up @@ -440,11 +428,6 @@
target = 4B05844F283A66090027DAD5 /* Example */;
targetProxy = 4B058461283A660A0027DAD5 /* PBXContainerItemProxy */;
};
4B058487283A67650027DAD5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B058481283A67650027DAD5 /* SwiftUI-snapshot-test */;
targetProxy = 4B058486283A67650027DAD5 /* PBXContainerItemProxy */;
};
4B9C5739284DE2DF001DE13A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4B9C5733284DE2DF001DE13A /* PreviewGroup */;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B9C5733284DE2DF001DE13A"
BuildableName = "PreviewGroup.framework"
BlueprintName = "PreviewGroup"
ReferencedContainer = "container:Example.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">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B9C5733284DE2DF001DE13A"
BuildableName = "PreviewGroup.framework"
BlueprintName = "PreviewGroup"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B058481283A67650027DAD5"
BuildableName = "SwiftUI_snapshot_test.framework"
BlueprintName = "SwiftUI-snapshot-test"
ReferencedContainer = "container:Example.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">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B058481283A67650027DAD5"
BuildableName = "SwiftUI_snapshot_test.framework"
BlueprintName = "SwiftUI-snapshot-test"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

0 comments on commit b9d7b35

Please sign in to comment.