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

Update for Xcode 13 / Apple Silicon #62

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 9 additions & 6 deletions OpenSim.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,20 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1320;
ORGANIZATIONNAME = "Luo Sheng";
TargetAttributes = {
B3A1E31E1BF049690090EC58 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1320;
};
};
};
buildConfigurationList = B3A1E31A1BF049690090EC58 /* Build configuration list for PBXProject "OpenSim" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
"pt-BR",
Expand Down Expand Up @@ -358,6 +357,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -414,6 +414,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -443,21 +444,23 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = OpenSim/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.pop-tap.OpenSim";
PRODUCT_NAME = OpenSim;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
B3A1E32E1BF049690090EC58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = OpenSim/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
Expand All @@ -466,7 +469,7 @@
PRODUCT_NAME = OpenSim;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
10 changes: 3 additions & 7 deletions OpenSim.xcodeproj/xcshareddata/xcschemes/OpenSim.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:OpenSim.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:OpenSim.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/AppMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AppMenuItem: NSMenuItem {
// Reverse the array to get the higher quality images first
for iconFile in application.iconFiles.reversed() {
if let bundle = Bundle(url: application.url) {
self.image = bundle.image(forResource: NSImage.Name(rawValue: iconFile))?.appIcon()
self.image = bundle.image(forResource: iconFile)?.appIcon()
if self.image != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/DirectoryWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class DirectoryWatcher {
oldDirectoryInfo = self.directoryInfo()

let timer = Timer(timeInterval: 0.5, target: self, selector: #selector(checkDirectoryInfo(_:)), userInfo: nil, repeats: true)
RunLoop.main.add(timer, forMode: RunLoopMode.commonModes)
RunLoop.main.add(timer, forMode: RunLoop.Mode.common)
}
}

Expand Down
2 changes: 2 additions & 0 deletions OpenSim/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
10 changes: 5 additions & 5 deletions OpenSim/MenuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protocol MenuManagerDelegate {

override init() {
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
statusItem.image = NSImage(named: NSImage.Name(rawValue: "menubar"))
statusItem.image = NSImage(named: "menubar")
statusItem.image!.isTemplate = true

super.init()
Expand Down Expand Up @@ -75,7 +75,7 @@ protocol MenuManagerDelegate {
DeviceManager.defaultManager.reload { (runtimes) in

var sortedList = [Runtime]()
_ = Dictionary(grouping: runtimes, by: { (runtime: Runtime) in
Dictionary(grouping: runtimes, by: { (runtime: Runtime) in
return runtime.platform
}).values.map({ (runtimeList: [Runtime]) -> [Runtime] in
return runtimeList.sorted { $0.version ?? 0.0 > $1.version ?? 0.0 }
Expand All @@ -97,8 +97,8 @@ protocol MenuManagerDelegate {

devices.forEach({ (device) in
let deviceMenuItem = menu.addItem(withTitle: device.name, action: nil, keyEquivalent: "")
deviceMenuItem.onStateImage = NSImage(named: NSImage.Name(rawValue: "active"))
deviceMenuItem.offStateImage = NSImage(named: NSImage.Name(rawValue: "inactive"))
deviceMenuItem.onStateImage = NSImage(named: "active")
deviceMenuItem.offStateImage = NSImage(named: "inactive")
deviceMenuItem.state = device.state == .booted ? .on : .off

let submenu = NSMenu()
Expand Down Expand Up @@ -193,7 +193,7 @@ protocol MenuManagerDelegate {
self.block = dispatch_block_t(delay) { [weak self] in
self?.watcher.stop()
self?.buildMenu()
try? self?.watcher.start()
((try? self?.watcher.start()) as ()??)
}
}

Expand Down