Skip to content

Commit

Permalink
Optimize Catalyst build for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Apr 29, 2021
1 parent 52f32ea commit 358e70b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 19 deletions.
18 changes: 8 additions & 10 deletions MobileCelestia.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -994,11 +994,13 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.0;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 103;
SHARED_BUILD_NUMBER = 106;
SHARED_BUILD_VERSION = 1.3.1;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -1052,10 +1054,12 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.0;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 103;
SHARED_BUILD_NUMBER = 106;
SHARED_BUILD_VERSION = 1.3.1;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
Expand All @@ -1077,7 +1081,6 @@
"$(PROJECT_DIR)/AppCenter",
);
INFOPLIST_FILE = MobileCelestia/Info.plist;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1090,7 +1093,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "MobileCelestia/Utils/MobileCelestia-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 arm64e x86_64";
};
name = Debug;
Expand All @@ -1109,7 +1112,6 @@
"$(PROJECT_DIR)/AppCenter",
);
INFOPLIST_FILE = MobileCelestia/Info.plist;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1121,7 +1123,7 @@
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "MobileCelestia/Utils/MobileCelestia-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 arm64e x86_64";
};
name = Release;
Expand All @@ -1134,7 +1136,6 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 22NR5428TD;
INFOPLIST_FILE = MobileCelestiaTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1156,7 +1157,6 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 22NR5428TD;
INFOPLIST_FILE = MobileCelestiaTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1180,7 +1180,6 @@
DEVELOPMENT_TEAM = 22NR5428TD;
INFOPLIST_FILE = CelestiaMacBridge/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = "$(SHARED_BUILD_VERSION)";
PRODUCT_BUNDLE_IDENTIFIER = space.celestia.CelestiaMacBridge;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1200,7 +1199,6 @@
DEVELOPMENT_TEAM = 22NR5428TD;
INFOPLIST_FILE = CelestiaMacBridge/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = "$(SHARED_BUILD_VERSION)";
PRODUCT_BUNDLE_IDENTIFIER = space.celestia.CelestiaMacBridge;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
13 changes: 10 additions & 3 deletions MobileCelestia/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
try? FileManager.default.removeItem(atPath: savedStatePath)
}
}
#else
UISlider.appearance().minimumTrackTintColor = .darkSliderMinimumTrackTintColor
UIBarButtonItem.appearance().tintColor = .themeLabel
UIButton.appearance().tintColor = .themeLabel
UITabBar.appearance().tintColor = .themeLabel
UISearchBar.appearance().tintColor = .themeLabel
UISegmentedControl.appearance().tintColor = .themeLabel
#endif

#if !DEBUG
Expand Down Expand Up @@ -163,13 +170,13 @@ extension AppDelegate {

builder.remove(menu: .newScene)

let identifierPrefix = Bundle.app.bundleIdentifier! + "."

let preferencesCommand = UIKeyCommand(title: CelestiaString("Preferences…", comment: ""), action: #selector(showPreferences), input: ",", modifierFlags: .command)
builder.insertSibling(UIMenu(identifier: .preferences, options: .displayInline, children: [
builder.insertSibling(UIMenu(identifier: UIMenu.Identifier(identifierPrefix + "preferences"), options: .displayInline, children: [
preferencesCommand
]), afterMenu: .about)

let identifierPrefix = Bundle.app.bundleIdentifier! + "."

builder.insertChild(UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(identifierPrefix + "open"), options: .displayInline, children: [
UIKeyCommand(title: CelestiaString("Run Script…", comment: ""), image: nil, action: #selector(openScriptFile), input: "O", modifierFlags: .command)
]), atStartOfMenu: .file)
Expand Down
2 changes: 1 addition & 1 deletion MobileCelestia/Event/EventFinderInputViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class EventFinderInputViewController: BaseTableViewController {
private let defaultSearchingInterval: TimeInterval = 365 * 24 * 60 * 60
private lazy var startTime = endTime.addingTimeInterval(-defaultSearchingInterval)
private lazy var endTime = Date()
private var objectName = "Earth"
private var objectName = LocalizedString("Earth", "celestia")

private let core = CelestiaAppCore.shared

Expand Down
2 changes: 2 additions & 0 deletions MobileCelestia/Info/BodyActionCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ final class BodyActionCell: UICollectionViewCell {
}
}
} else {
button.titleLabel?.lineBreakMode = .byWordWrapping
button.titleLabel?.textAlignment = .center
button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 0, bottom: 12, right: 0)
button.layer.cornerRadius = 4
#if targetEnvironment(macCatalyst)
Expand Down
1 change: 1 addition & 0 deletions MobileCelestia/Resource/Views/ProgressButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ProgressButton: UIButton {
layer.cornerRadius = cornerRadius
layer.masksToBounds = true

titleLabel?.lineBreakMode = .byWordWrapping
titleLabel?.textAlignment = .center
titleLabel?.textColor = .white
titleLabel?.font = UIFont.boldSystemFont(ofSize: 0)
Expand Down
4 changes: 3 additions & 1 deletion MobileCelestia/Settings/SettingTextCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ private extension SettingTextCell {
detailLabel.textColor = .darkTertiaryLabel

detailLabel.font = UIFont.preferredFont(forTextStyle: .body)
detailLabel.numberOfLines = 0
detailLabel.numberOfLines = 1
detailLabel.adjustsFontSizeToFitWidth = true
detailLabel.minimumScaleFactor = 0.4

NSLayoutConstraint.activate([
detailLabel.leadingAnchor.constraint(greaterThanOrEqualTo: label.trailingAnchor, constant: 16),
Expand Down
3 changes: 0 additions & 3 deletions MobileCelestia/Settings/SettngSliderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ private extension SettingSliderCell {
label.topAnchor.constraint(equalTo: topContainer.topAnchor, constant: 12),
])

#if !targetEnvironment(macCatalyst)
slider.minimumTrackTintColor = .darkSliderMinimumTrackTintColor
#endif
slider.minimumValue = 0
slider.maximumValue = 100
slider.translatesAutoresizingMaskIntoConstraints = false
Expand Down
4 changes: 3 additions & 1 deletion MobileCelestia/Tutorial/TutorialActionCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TutorialActionCell: UITableViewCell {
var title: String? { didSet { button.setTitle(title, for: .normal) } }
var actionHandler: (() -> Void)?

private lazy var button = UIButton(type: .system)
private lazy var button = StandardButton(type: .system)

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
Expand Down Expand Up @@ -46,6 +46,8 @@ private extension TutorialActionCell {
}
}
} else {
button.titleLabel?.lineBreakMode = .byWordWrapping
button.titleLabel?.textAlignment = .center
button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 0, bottom: 12, right: 0)
button.layer.cornerRadius = 4
#if targetEnvironment(macCatalyst)
Expand Down

0 comments on commit 358e70b

Please sign in to comment.