Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation on macOS #30

Merged
merged 3 commits into from Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Expand Up @@ -26,10 +26,10 @@ jobs:
# Latest watchOS
- sdk: "watchsimulator"
destination: "OS=8.3,name=Apple Watch Series 7 - 45mm"
# Latest macOS (disabled due to lack of macOS UI support)
#- sdk: "macosx12.1"
#destination: "platform=macOS"

# Latest macOS
- sdk: "macosx12.1"
destination: "platform=macOS"

steps:
- name: Checkout
Expand Down Expand Up @@ -59,11 +59,13 @@ jobs:

# Latest iOS Build
- sdk: "iphonesimulator"
scheme: "Example (iOS)"
destination: "platform=iOS Simulator,OS=15.2,name=iPhone 12 Pro Max"

# Latest macOS (disabled due to lack of macOS UI support)
#- sdk: "macosx12.1"
#destination: "platform=macOS"
# Latest macOS
- sdk: "macosx12.1"
scheme: "Example (macOS)"
destination: "platform=macOS"

steps:
- name: Checkout
Expand All @@ -81,6 +83,6 @@ jobs:
run: |
xcodebuild build \
-project "Example.xcodeproj" \
-scheme "Example" \
-scheme "${{ matrix.scheme }}" \
-sdk "${{ matrix.sdk }}" \
-destination "${{ matrix.destination }}"
267 changes: 203 additions & 64 deletions Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions Example/Assets.xcassets/AppIcon.appiconset/Contents.json
Expand Up @@ -89,6 +89,56 @@
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion Example/CustomButton.swift
Expand Up @@ -7,7 +7,7 @@ struct CustomButton: View {

var body: some View {
Button(title) {
action(.now)
action(Date())
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions Example/Preview Content/Preview Assets.xcassets/Contents.json

This file was deleted.

10 changes: 10 additions & 0 deletions Example/macOS.entitlements
@@ -0,0 +1,10 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Package.swift
Expand Up @@ -6,7 +6,7 @@ let package = Package(
name: "Exhibition",
platforms: [
.iOS(.v15),
.macOS(.v12),
.macOS(.v11),
.watchOS(.v8),
.tvOS(.v14)
],
Expand Down
17 changes: 11 additions & 6 deletions Sources/Exhibition/DebugView.swift
Expand Up @@ -7,13 +7,13 @@ struct DebugView: View {
@Binding var preferredColorScheme: ColorScheme
@Binding var layoutDirection: LayoutDirection

@Environment(\.dismiss) var dismiss
@Environment(\.presentationMode) var presentationMode
@Environment(\.parameterViews) var parameterViews

var body: some View {
NavigationView {
Form {
Section("Accessibility") {
Section {
Picker("Color Scheme", selection: $preferredColorScheme) {
Text("Light").tag(ColorScheme.light)
Text("Dark").tag(ColorScheme.dark)
Expand All @@ -23,19 +23,23 @@ struct DebugView: View {
Text("Left to Right").tag(LayoutDirection.leftToRight)
Text("Right to Left").tag(LayoutDirection.rightToLeft)
}
} header: {
Text("Accessibility")
}

if context.parameters.isEmpty == false {
Section("Parameters") {
Section {
ForEach(
context.parameters.sorted(by: keyAscending), id: \.key,
content: parameterView
)
} header: {
Text("Parameters")
}
}

if context.log.isEmpty == false {
Section("Log") {
Section {
Text(context.log.joined(separator: "\n"))
.modify {
#if os(iOS)
Expand All @@ -44,15 +48,16 @@ struct DebugView: View {
$0
#endif
}
} header: {
Text("Log")
}
}
}
.navigationTitle("Debug")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem {
Button("Done") {
dismiss()
presentationMode.wrappedValue.dismiss()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Exhibition/Defaultable.swift
Expand Up @@ -33,5 +33,5 @@ extension Dictionary: Defaultable {
}

extension Date: Defaultable {
public static var defaultValue: Date = .now
public static var defaultValue: Date = Date()
}
13 changes: 10 additions & 3 deletions Sources/Exhibition/Exhibition.swift
Expand Up @@ -42,16 +42,23 @@ public struct Exhibition: View {
NavigationLink(exhibit.id, destination: debuggable(exhibit))
}
} else {
Section(section.key) {
Section {
ForEach(section.value) { exhibit in
NavigationLink(exhibit.id, destination: debuggable(exhibit))
}
} header: {
Text(section.key)
}
}
}
.searchable(text: $searchText)
.modify {
if #available(macOS 12.0, *) {
$0.searchable(text: $searchText)
} else {
$0
}
}
.navigationTitle("Exhibit")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem {
Button {
Expand Down
Expand Up @@ -27,7 +27,7 @@ struct ClosureParameterView: ParameterView {
Spacer()
Text(value.signature)
Spacer()
Text(value.callCount.formatted())
Text("\(value.callCount)")
}
}
}
4 changes: 2 additions & 2 deletions Sources/Exhibition/Utilities/View+Modify.swift
Expand Up @@ -16,8 +16,8 @@ extension View {
/// }
///
/// - Returns: A modified view
@ViewBuilder public func modify<Output: View>(
_ block: (Self) -> Output
func modify<Output: View>(
@ViewBuilder _ block: (Self) -> Output
) -> some View {
block(self)
}
Expand Down