Skip to content

Fix for Mac Catalyst #247

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

Merged
merged 7 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions Examples/Example/Snapshot Tests/BaseSnapshotTestCase.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2018-present Frédéric Maquin <[email protected]> and contributors.
// Licensed under the terms of the MIT License.

#if targetEnvironment(macCatalyst)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question about the snapshot tests and catalyst. Are they conditionally excluded because iOSSnapshotTestCase doesn't support catalyst? Did you run into issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not use iOSSnapshotTestCase on macOS as following error.
Screen Shot 2020-10-05 at 13 59 56
I tried carthage update --platform macOS but I got an error Dependency "ios-snapshot-test-case" has no shared framework schemes for any of the platforms: Mac.

I think iOSSnapshotTestCase does not support macOS.

#else
import Foundation

@testable import Instructions
Expand Down Expand Up @@ -40,3 +42,4 @@ class BaseSnapshotTests: FBSnapshotTestCase {
}.first
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2018-present Frédéric Maquin <[email protected]> and contributors.
// Licensed under the terms of the MIT License.

#if targetEnvironment(macCatalyst)
#else
@testable import Instructions
@testable import InstructionsExample
import FBSnapshotTestCase
Expand Down Expand Up @@ -142,3 +144,4 @@ class DefaultExampleSnapshotTests: BaseSnapshotTests,
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ internal class CustomCoachMarkBodyView: UIView, CoachMarkBodyView {
self.hintLabel.font = UIFont.systemFont(ofSize: 15.0)
self.hintLabel.isScrollEnabled = false
self.hintLabel.textAlignment = .justified
#if targetEnvironment(macCatalyst)
#else
self.hintLabel.layoutManager.hyphenationFactor = 1.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll do a sweep after this PR to remove them, I didn't realised it was deprecated in iOS 14 and unavailable in Catalyst.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it!

#endif
self.hintLabel.isEditable = false

self.nextButton.translatesAutoresizingMaskIntoConstraints = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ internal class TransparentCoachMarkBodyView: UIControl, CoachMarkBodyView {
hintLabel.font = UIFont.systemFont(ofSize: 15.0)
hintLabel.isScrollEnabled = false
hintLabel.textAlignment = .justified
#if targetEnvironment(macCatalyst)
#else
hintLabel.layoutManager.hyphenationFactor = 1.0
#endif
hintLabel.isEditable = false

hintLabel.translatesAutoresizingMaskIntoConstraints = false
Expand Down
64 changes: 32 additions & 32 deletions Examples/Example/Sources/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,43 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleName</key>
<string>Instructions</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Instructions</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>ephread.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand All @@ -54,30 +48,36 @@
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
</dict>
</array>
</dict>
</dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
</dict>
</plist>
11 changes: 9 additions & 2 deletions Examples/Example/UI Tests/TransitionExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@
import XCTest

class TransitionExampleTests: XCTestCase {

#if targetEnvironment(macCatalyst)
#else
let originalOrientation = XCUIDevice.shared.orientation

#endif
override func setUp() {
super.setUp()
continueAfterFailure = false

XCUIApplication().launchWithAnimationsDisabled()
#if targetEnvironment(macCatalyst)
#else
XCUIDevice.shared.orientation = .portrait
#endif
}

override func tearDown() {
super.tearDown()
#if targetEnvironment(macCatalyst)
#else
XCUIDevice.shared.orientation = originalOrientation
#endif
}

func testTapThroughCutout() {
Expand Down
13 changes: 8 additions & 5 deletions Examples/Instructions Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
5B84A3AE1BF48BE200C795F8 /* OnlyHintsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B84A3AD1BF48BE200C795F8 /* OnlyHintsViewController.swift */; };
B6105E392434FEC600B45CDA /* XCUIApplication+Launch.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6105E372434FE9E00B45CDA /* XCUIApplication+Launch.swift */; };
B6105E3C2435123D00B45CDA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B6105E3E2435123D00B45CDA /* Localizable.strings */; };
B618494220C2472200315E1C /* PausingCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B618494120C2472100315E1C /* PausingCodeViewController.swift */; };
B639B28D20D4E7AA009996CF /* DefaultExampleSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6C9D6A020D4103700EBC03A /* DefaultExampleSnapshotTests.swift */; };
B639B28E20D4E7CA009996CF /* FBSnapshotTestCase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6C9D69A20D40DFD00EBC03A /* FBSnapshotTestCase.framework */; };
B639B29120D4E829009996CF /* BaseSnapshotTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = B639B28F20D4E807009996CF /* BaseSnapshotTestCase.swift */; };
B639B28D20D4E7AA009996CF /* DefaultExampleSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6C9D6A020D4103700EBC03A /* DefaultExampleSnapshotTests.swift */; platformFilter = ios; };
B639B28E20D4E7CA009996CF /* FBSnapshotTestCase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6C9D69A20D40DFD00EBC03A /* FBSnapshotTestCase.framework */; platformFilter = ios; settings = {ATTRIBUTES = (Required, ); }; };
B639B29120D4E829009996CF /* BaseSnapshotTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = B639B28F20D4E807009996CF /* BaseSnapshotTestCase.swift */; platformFilter = ios; };
B6454D6220C78C2A00DCF351 /* LargeCutoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6454D5F20C78C2900DCF351 /* LargeCutoutViewController.swift */; };
B65DDDC21EE2C5F1002618AF /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65DDDC11EE2C5F1002618AF /* Extensions.swift */; };
B65DDDD41EE2EED0002618AF /* KeyboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65DDDD31EE2EED0002618AF /* KeyboardViewController.swift */; };
Expand Down Expand Up @@ -49,7 +49,7 @@
B6CA4A9720BEBB53006F42AC /* CustomExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6CA4A9620BEBB53006F42AC /* CustomExampleTests.swift */; };
B6CA4A9920BEC111006F42AC /* AccessibilityIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6CA4A9820BEC111006F42AC /* AccessibilityIdentifiers.swift */; };
B6CA4A9B20BED19B006F42AC /* TransitionExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6CA4A9A20BED19B006F42AC /* TransitionExampleTests.swift */; };
B6F2327823484DFF00040090 /* FBSnapshotTestCase.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6C9D69A20D40DFD00EBC03A /* FBSnapshotTestCase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B6F2327823484DFF00040090 /* FBSnapshotTestCase.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6C9D69A20D40DFD00EBC03A /* FBSnapshotTestCase.framework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C615FBAF1D7A1BB500EAEEFB /* TestFlowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C615FBAE1D7A1BB500EAEEFB /* TestFlowViewController.swift */; };
C636FFAA1BBBD99200EB243B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C636FFA91BBBD99200EB243B /* Assets.xcassets */; };
C636FFB11BBC329600EB243B /* TransparentCoachMarkArrowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C636FFAF1BBC329600EB243B /* TransparentCoachMarkArrowView.swift */; };
Expand Down Expand Up @@ -206,6 +206,7 @@
C6CE542B1BBD435500154266 /* DefaultViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultViewController.swift; sourceTree = "<group>"; };
C6CE542F1BBD43CB00154266 /* DelegateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateViewController.swift; sourceTree = "<group>"; };
C6CE54301BBD43CB00154266 /* MixedCoachMarksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MixedCoachMarksViewController.swift; sourceTree = "<group>"; };
E93D21882525BCD900B3A315 /* InstructionsExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = InstructionsExample.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -512,6 +513,7 @@
C64FB3031BB6CB1C0081E5B6 = {
isa = PBXGroup;
children = (
E93D21882525BCD900B3A315 /* InstructionsExample.entitlements */,
B6C9D69120D40BDA00EBC03A /* Frameworks */,
C64FB30D1BB6CB1C0081E5B6 /* Products */,
C64FB32C1BB6CC180081E5B6 /* Sources */,
Expand Down Expand Up @@ -844,6 +846,7 @@
/* Begin PBXTargetDependency section */
B639B28720D4E71D009996CF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilter = ios;
target = C64FB30B1BB6CB1C0081E5B6 /* InstructionsExample */;
targetProxy = B639B28620D4E71D009996CF /* PBXContainerItemProxy */;
};
Expand Down
10 changes: 10 additions & 0 deletions Examples/InstructionsExample.entitlements
Original file line number Diff line number Diff line change
@@ -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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these entitlements required by Catalyst?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run an app on macOS Catalina, we have to notarize the app. This file is added by Xcode when I ran an example app on my mac. So I think, as you mentioned, the entitlements required by Catalyst.

<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ private extension CoachMarkBodyDefaultView {
// MARK: Builders
func makeHintTextView() -> UITextView {
let textView = UITextView().preparedForAutoLayout()

#if targetEnvironment(macCatalyst)
#else
textView.layoutManager.hyphenationFactor = 1.0
#endif
textView.textAlignment = .justified
textView.textColor = InstructionsColor.coachMarkLabel
textView.font = UIFont.systemFont(ofSize: 15.0)
Expand Down