Skip to content
This repository was archived by the owner on Dec 27, 2020. It is now read-only.

Commit c84b194

Browse files
committed
watchos content view
1 parent 904eebe commit c84b194

File tree

12 files changed

+72
-46
lines changed

12 files changed

+72
-46
lines changed

Examples/GridExamples watchOS WatchKit Extension/ContentView.swift

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
1-
//
2-
// ContentView.swift
3-
// GridExamples watchOS WatchKit Extension
4-
//
5-
// Created by Alex Young on 2019-08-25.
6-
//
7-
81
import SwiftUI
2+
import Grid
93

104
struct ContentView: View {
115
var body: some View {
12-
Text("Hello World")
6+
List {
7+
NavigationLink(destination: AutoColumnsLayoutView()) {
8+
HStack {
9+
Image(systemName: "square.grid.3x2.fill")
10+
.foregroundColor(.accentColor)
11+
Text("Auto Columns")
12+
}
13+
14+
}
15+
NavigationLink(destination: FixedColumnsLayoutView()) {
16+
HStack {
17+
Image(systemName: "rectangle.split.3x3.fill")
18+
.foregroundColor(.accentColor)
19+
Text("Fixed Columns")
20+
}
21+
}
22+
NavigationLink(destination: SingleColumnLayoutView()) {
23+
HStack {
24+
Image(systemName: "rectangle.grid.1x2.fill")
25+
.foregroundColor(.accentColor)
26+
Text("One Column")
27+
}
28+
}
29+
NavigationLink(destination: PerformanceLayoutView()) {
30+
HStack {
31+
Image(systemName: "square.grid.4x3.fill")
32+
.foregroundColor(.accentColor)
33+
Text("Performance")
34+
}
35+
}
36+
}
37+
.accentColor(.purple)
1338
}
1439
}
1540

Examples/GridExamples watchOS WatchKit Extension/ExtensionDelegate.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// ExtensionDelegate.swift
3-
// GridExamples watchOS WatchKit Extension
4-
//
5-
// Created by Alex Young on 2019-08-25.
6-
//
7-
81
import WatchKit
92

103
class ExtensionDelegate: NSObject, WKExtensionDelegate {

Examples/GridExamples watchOS WatchKit Extension/HostingController.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// HostingController.swift
3-
// GridExamples watchOS WatchKit Extension
4-
//
5-
// Created by Alex Young on 2019-08-25.
6-
//
7-
81
import WatchKit
92
import Foundation
103
import SwiftUI

Examples/GridExamples watchOS WatchKit Extension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<key>NSExtensionAttributes</key>
2626
<dict>
2727
<key>WKAppBundleIdentifier</key>
28-
<string>com.spacenation.GridExamples-watchOS.watchkitapp</string>
28+
<string>com.spacenation.grid.examples.watchos.watchkitapp</string>
2929
</dict>
3030
<key>NSExtensionPointIdentifier</key>
3131
<string>com.apple.watchkit</string>

Examples/GridExamples.xcodeproj/project.pbxproj

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@
1414
FA61E95A23134505006A5B6B /* GridExamples watchOS WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = FA61E95923134505006A5B6B /* GridExamples watchOS WatchKit App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1515
FA61E96023134505006A5B6B /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA61E95E23134505006A5B6B /* Interface.storyboard */; };
1616
FA61E96223134507006A5B6B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA61E96123134507006A5B6B /* Assets.xcassets */; };
17-
FA61E96923134507006A5B6B /* GridExamples watchOS WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = FA61E96823134507006A5B6B /* GridExamples watchOS WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1817
FA61E96E23134507006A5B6B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA61E96D23134507006A5B6B /* ContentView.swift */; };
1918
FA61E97023134507006A5B6B /* HostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA61E96F23134507006A5B6B /* HostingController.swift */; };
2019
FA61E97223134507006A5B6B /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA61E97123134507006A5B6B /* ExtensionDelegate.swift */; };
2120
FA61E97423134508006A5B6B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA61E97323134508006A5B6B /* Assets.xcassets */; };
2221
FA61E97723134508006A5B6B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA61E97623134508006A5B6B /* Preview Assets.xcassets */; };
22+
FA61E98523134656006A5B6B /* Grid in Frameworks */ = {isa = PBXBuildFile; productRef = FA61E98423134656006A5B6B /* Grid */; };
23+
FA61E98623134C61006A5B6B /* GridExamples watchOS WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = FA61E96823134507006A5B6B /* GridExamples watchOS WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
24+
FA61E98A23134CF8006A5B6B /* Color+Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA902160230B379D00BF9341 /* Color+Random.swift */; };
25+
FA61E98B23134D22006A5B6B /* AutoColumnsLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA902169230B39C800BF9341 /* AutoColumnsLayoutView.swift */; };
26+
FA61E98C23134D22006A5B6B /* FixedColumnsLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA61E9512312FF0F006A5B6B /* FixedColumnsLayoutView.swift */; };
27+
FA61E98D23134D22006A5B6B /* SingleColumnLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA61E94E2312FE6D006A5B6B /* SingleColumnLayoutView.swift */; };
28+
FA61E98E23134D22006A5B6B /* PerformanceLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90216C230B3EC100BF9341 /* PerformanceLayoutView.swift */; };
29+
FA61E98F23134D3F006A5B6B /* Card.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA902163230B389900BF9341 /* Card.swift */; };
2330
FA6ED893231090FF00651DD9 /* BuilderLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA6ED892231090FF00651DD9 /* BuilderLayoutView.swift */; };
2431
FA6ED894231090FF00651DD9 /* BuilderLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA6ED892231090FF00651DD9 /* BuilderLayoutView.swift */; };
2532
FA902115230B32EA00BF9341 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA902114230B32EA00BF9341 /* AppDelegate.swift */; };
@@ -53,7 +60,7 @@
5360
remoteGlobalIDString = FA61E95823134505006A5B6B;
5461
remoteInfo = "GridExamples watchOS WatchKit App";
5562
};
56-
FA61E96A23134507006A5B6B /* PBXContainerItemProxy */ = {
63+
FA61E98723134C61006A5B6B /* PBXContainerItemProxy */ = {
5764
isa = PBXContainerItemProxy;
5865
containerPortal = FA902107230B32A500BF9341 /* Project object */;
5966
proxyType = 1;
@@ -74,13 +81,13 @@
7481
name = "Embed Watch Content";
7582
runOnlyForDeploymentPostprocessing = 0;
7683
};
77-
FA61E97E23134508006A5B6B /* Embed App Extensions */ = {
84+
FA61E98923134C61006A5B6B /* Embed App Extensions */ = {
7885
isa = PBXCopyFilesBuildPhase;
7986
buildActionMask = 2147483647;
8087
dstPath = "";
8188
dstSubfolderSpec = 13;
8289
files = (
83-
FA61E96923134507006A5B6B /* GridExamples watchOS WatchKit Extension.appex in Embed App Extensions */,
90+
FA61E98623134C61006A5B6B /* GridExamples watchOS WatchKit Extension.appex in Embed App Extensions */,
8491
);
8592
name = "Embed App Extensions";
8693
runOnlyForDeploymentPostprocessing = 0;
@@ -133,6 +140,7 @@
133140
isa = PBXFrameworksBuildPhase;
134141
buildActionMask = 2147483647;
135142
files = (
143+
FA61E98523134656006A5B6B /* Grid in Frameworks */,
136144
);
137145
runOnlyForDeploymentPostprocessing = 0;
138146
};
@@ -304,12 +312,12 @@
304312
buildConfigurationList = FA61E98223134508006A5B6B /* Build configuration list for PBXNativeTarget "GridExamples watchOS WatchKit App" */;
305313
buildPhases = (
306314
FA61E95723134505006A5B6B /* Resources */,
307-
FA61E97E23134508006A5B6B /* Embed App Extensions */,
315+
FA61E98923134C61006A5B6B /* Embed App Extensions */,
308316
);
309317
buildRules = (
310318
);
311319
dependencies = (
312-
FA61E96B23134507006A5B6B /* PBXTargetDependency */,
320+
FA61E98823134C61006A5B6B /* PBXTargetDependency */,
313321
);
314322
name = "GridExamples watchOS WatchKit App";
315323
productName = "GridExamples watchOS WatchKit App";
@@ -329,6 +337,9 @@
329337
dependencies = (
330338
);
331339
name = "GridExamples watchOS WatchKit Extension";
340+
packageProductDependencies = (
341+
FA61E98423134656006A5B6B /* Grid */,
342+
);
332343
productName = "GridExamples watchOS WatchKit Extension";
333344
productReference = FA61E96823134507006A5B6B /* GridExamples watchOS WatchKit Extension.appex */;
334345
productType = "com.apple.product-type.watchkit2-extension";
@@ -477,9 +488,15 @@
477488
isa = PBXSourcesBuildPhase;
478489
buildActionMask = 2147483647;
479490
files = (
491+
FA61E98D23134D22006A5B6B /* SingleColumnLayoutView.swift in Sources */,
492+
FA61E98F23134D3F006A5B6B /* Card.swift in Sources */,
493+
FA61E98E23134D22006A5B6B /* PerformanceLayoutView.swift in Sources */,
494+
FA61E98A23134CF8006A5B6B /* Color+Random.swift in Sources */,
495+
FA61E98C23134D22006A5B6B /* FixedColumnsLayoutView.swift in Sources */,
480496
FA61E97023134507006A5B6B /* HostingController.swift in Sources */,
481497
FA61E96E23134507006A5B6B /* ContentView.swift in Sources */,
482498
FA61E97223134507006A5B6B /* ExtensionDelegate.swift in Sources */,
499+
FA61E98B23134D22006A5B6B /* AutoColumnsLayoutView.swift in Sources */,
483500
);
484501
runOnlyForDeploymentPostprocessing = 0;
485502
};
@@ -524,10 +541,10 @@
524541
target = FA61E95823134505006A5B6B /* GridExamples watchOS WatchKit App */;
525542
targetProxy = FA61E95B23134505006A5B6B /* PBXContainerItemProxy */;
526543
};
527-
FA61E96B23134507006A5B6B /* PBXTargetDependency */ = {
544+
FA61E98823134C61006A5B6B /* PBXTargetDependency */ = {
528545
isa = PBXTargetDependency;
529546
target = FA61E96723134507006A5B6B /* GridExamples watchOS WatchKit Extension */;
530-
targetProxy = FA61E96A23134507006A5B6B /* PBXContainerItemProxy */;
547+
targetProxy = FA61E98723134C61006A5B6B /* PBXContainerItemProxy */;
531548
};
532549
/* End PBXTargetDependency section */
533550

@@ -616,7 +633,7 @@
616633
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
617634
MTL_FAST_MATH = YES;
618635
ONLY_ACTIVE_ARCH = YES;
619-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS";
636+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos;
620637
PRODUCT_NAME = "$(TARGET_NAME)";
621638
SDKROOT = iphoneos;
622639
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -675,7 +692,7 @@
675692
MARKETING_VERSION = 1.0;
676693
MTL_ENABLE_DEBUG_INFO = NO;
677694
MTL_FAST_MATH = YES;
678-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS";
695+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos;
679696
PRODUCT_NAME = "$(TARGET_NAME)";
680697
SDKROOT = iphoneos;
681698
SWIFT_COMPILATION_MODE = wholemodule;
@@ -688,7 +705,6 @@
688705
FA61E97C23134508006A5B6B /* Debug */ = {
689706
isa = XCBuildConfiguration;
690707
buildSettings = {
691-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
692708
ALWAYS_SEARCH_USER_PATHS = NO;
693709
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
694710
CLANG_ANALYZER_NONNULL = YES;
@@ -744,7 +760,7 @@
744760
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
745761
MTL_FAST_MATH = YES;
746762
ONLY_ACTIVE_ARCH = YES;
747-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS.watchkitapp";
763+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos.watchkitapp;
748764
PRODUCT_NAME = "$(TARGET_NAME)";
749765
SDKROOT = watchos;
750766
SKIP_INSTALL = YES;
@@ -759,7 +775,6 @@
759775
FA61E97D23134508006A5B6B /* Release */ = {
760776
isa = XCBuildConfiguration;
761777
buildSettings = {
762-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
763778
ALWAYS_SEARCH_USER_PATHS = NO;
764779
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
765780
CLANG_ANALYZER_NONNULL = YES;
@@ -808,7 +823,7 @@
808823
INFOPLIST_FILE = "GridExamples watchOS WatchKit App/Info.plist";
809824
MTL_ENABLE_DEBUG_INFO = NO;
810825
MTL_FAST_MATH = YES;
811-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS.watchkitapp";
826+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos.watchkitapp;
812827
PRODUCT_NAME = "$(TARGET_NAME)";
813828
SDKROOT = watchos;
814829
SKIP_INSTALL = YES;
@@ -885,7 +900,7 @@
885900
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
886901
MTL_FAST_MATH = YES;
887902
ONLY_ACTIVE_ARCH = YES;
888-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS.watchkitapp.watchkitextension";
903+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos.watchkitapp.watchkitextension;
889904
PRODUCT_NAME = "${TARGET_NAME}";
890905
SDKROOT = watchos;
891906
SKIP_INSTALL = YES;
@@ -954,7 +969,7 @@
954969
);
955970
MTL_ENABLE_DEBUG_INFO = NO;
956971
MTL_FAST_MATH = YES;
957-
PRODUCT_BUNDLE_IDENTIFIER = "com.spacenation.GridExamples-watchOS.watchkitapp.watchkitextension";
972+
PRODUCT_BUNDLE_IDENTIFIER = com.spacenation.grid.examples.watchos.watchkitapp.watchkitextension;
958973
PRODUCT_NAME = "${TARGET_NAME}";
959974
SDKROOT = watchos;
960975
SKIP_INSTALL = YES;
@@ -1343,6 +1358,10 @@
13431358
/* End XCRemoteSwiftPackageReference section */
13441359

13451360
/* Begin XCSwiftPackageProductDependency section */
1361+
FA61E98423134656006A5B6B /* Grid */ = {
1362+
isa = XCSwiftPackageProductDependency;
1363+
productName = Grid;
1364+
};
13461365
FA902127230B334800BF9341 /* Grid */ = {
13471366
isa = XCSwiftPackageProductDependency;
13481367
package = FA902126230B334800BF9341 /* XCRemoteSwiftPackageReference "grid" */;

Examples/GridExamples/SingleColumnLayoutView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct SingleColumnLayoutView: View {
88
}
99
.padding()
1010
.gridStyle(
11-
SingleColumnGridStyle(itemHeight: 160)
11+
SingleColumnGridStyle(itemHeight: 80)
1212
)
1313
}
1414
}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PackageDescription
66
let package = Package(
77
name: "Grid",
88
platforms: [
9-
.iOS(.v13), .macOS(.v10_15)
9+
.iOS(.v13), .macOS(.v10_15), .watchOS(.v6)
1010
],
1111
products: [
1212
.library(

Sources/Grid/AutoColumnsGridStyle.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22

33
/// The default `Grid` style.
4-
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
54
public struct AutoColumnsGridStyle: GridStyle {
65
public var padding = EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
76

Sources/Grid/FixedColumnsGridStyle.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22

33
/// Fixed columns `Grid` style.
4-
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
54
public struct FixedColumnsGridStyle: GridStyle {
65
public var padding = EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
76

Sources/Grid/Grid+Style.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22

33
/// A specification for the appearance of a `Grid`.
4-
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
54
public protocol GridStyle {
65
var padding: EdgeInsets { get set }
76

0 commit comments

Comments
 (0)