diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj
index 10e6af2..5ad7d15 100644
--- a/Box42.xcodeproj/project.pbxproj
+++ b/Box42.xcodeproj/project.pbxproj
@@ -3,10 +3,11 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
+ D676A64A2A8C5CEA00B5C319 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = D676A6492A8C5CEA00B5C319 /* SnapKit */; };
DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */; };
DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */; };
DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */; };
@@ -97,6 +98,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ D676A64A2A8C5CEA00B5C319 /* SnapKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -295,6 +297,9 @@
dependencies = (
);
name = Box42;
+ packageProductDependencies = (
+ D676A6492A8C5CEA00B5C319 /* SnapKit */,
+ );
productName = Box42;
productReference = DE018BAF2A5099F900FF0AA3 /* Box42.app */;
productType = "com.apple.product-type.application";
@@ -322,6 +327,9 @@
Base,
);
mainGroup = DE018BA62A5099F900FF0AA3;
+ packageReferences = (
+ D676A6482A8C5CEA00B5C319 /* XCRemoteSwiftPackageReference "SnapKit" */,
+ );
productRefGroup = DE018BB02A5099F900FF0AA3 /* Products */;
projectDirPath = "";
projectRoot = "";
@@ -568,6 +576,25 @@
};
/* End XCConfigurationList section */
+/* Begin XCRemoteSwiftPackageReference section */
+ D676A6482A8C5CEA00B5C319 /* XCRemoteSwiftPackageReference "SnapKit" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/SnapKit/SnapKit.git";
+ requirement = {
+ kind = exactVersion;
+ version = 5.6.0;
+ };
+ };
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+ D676A6492A8C5CEA00B5C319 /* SnapKit */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = D676A6482A8C5CEA00B5C319 /* XCRemoteSwiftPackageReference "SnapKit" */;
+ productName = SnapKit;
+ };
+/* End XCSwiftPackageProductDependency section */
+
/* Begin XCVersionGroup section */
DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */ = {
isa = XCVersionGroup;
diff --git a/Box42.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Box42.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
new file mode 100644
index 0000000..19d4e8c
--- /dev/null
+++ b/Box42.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -0,0 +1,16 @@
+{
+ "object": {
+ "pins": [
+ {
+ "package": "SnapKit",
+ "repositoryURL": "https://github.com/SnapKit/SnapKit.git",
+ "state": {
+ "branch": null,
+ "revision": "f222cbdf325885926566172f6f5f06af95473158",
+ "version": "5.6.0"
+ }
+ }
+ ]
+ },
+ "version": 1
+}
diff --git a/Box42.xcodeproj/project.xcworkspace/xcuserdata/daskim.xcuserdatad/UserInterfaceState.xcuserstate b/Box42.xcodeproj/project.xcworkspace/xcuserdata/daskim.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..8f50922
Binary files /dev/null and b/Box42.xcodeproj/project.xcworkspace/xcuserdata/daskim.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Box42/Box/BoxButtonViewGroup.swift b/Box42/Box/BoxButtonViewGroup.swift
index e71a3f8..748e8c8 100644
--- a/Box42/Box/BoxButtonViewGroup.swift
+++ b/Box42/Box/BoxButtonViewGroup.swift
@@ -6,6 +6,7 @@
//
import Cocoa
+import SnapKit
class BoxButtonViewGroup: NSView {
var boxVM: WebViewModel! = WebViewModel()
@@ -91,6 +92,31 @@ class BoxButtonViewGroup: NSView {
// ])
//
// lastAddedButton = button
+// }
+//
+// func createHomeButton() {
+// let button = NSButton(title: "home", image: NSImage(imageLiteralResourceName: "42box_logo"), target: self, action: #selector(clickBtn(sender:)))
+// super.addSubview(button)
+//
+// button.translatesAutoresizingMaskIntoConstraints = false
+// button.isBordered = false
+// button.imagePosition = .imageOnly
+//
+//
+//// NSLayoutConstraint.activate([
+//// button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20),
+//// button.topAnchor.constraint(equalTo: self.topAnchor, constant: 0),
+//// button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20),
+////// button.heightAnchor.constraint(equalToConstant: 30)
+//// ])
+//
+// NSLayoutConstraint.activate([
+//// button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20), // 좌측 간격을 100에서 20으로 변경
+//// button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20), // 우측 간격을 80에서 20으로 변경
+//// button.heightAnchor.constraint(equalToConstant: 30)
+// ])
+//
+// lastAddedButton = nil // home 버튼 이후의 버튼들이 상단에 연결되지 않도록 설정
// }
func createHomeButton() {
@@ -100,25 +126,24 @@ class BoxButtonViewGroup: NSView {
button.translatesAutoresizingMaskIntoConstraints = false
button.isBordered = false
button.imagePosition = .imageOnly
-
-
-// NSLayoutConstraint.activate([
-// button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20),
-// button.topAnchor.constraint(equalTo: self.topAnchor, constant: 0),
-// button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20),
-//// button.heightAnchor.constraint(equalToConstant: 30)
-// ])
- NSLayoutConstraint.activate([
- button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20), // 좌측 간격을 100에서 20으로 변경
- button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20), // 우측 간격을 80에서 20으로 변경
- button.heightAnchor.constraint(equalToConstant: 30)
- ])
+ button.snp.makeConstraints { make in
+ make.leading.equalToSuperview().offset(20)
+ make.trailing.equalToSuperview().offset(-20)
+ make.height.equalTo(30)
+
+ if let lastButton = lastAddedButton {
+ make.top.equalTo(lastButton.snp.bottom).offset(10)
+ } else {
+ make.top.equalToSuperview()
+ }
+ }
- lastAddedButton = nil // home 버튼 이후의 버튼들이 상단에 연결되지 않도록 설정
+ lastAddedButton = button
}
+
// func createQuitButton() {
// let button = NSButton()
diff --git a/Box42/Main/BoxViewController.swift b/Box42/Main/BoxViewController.swift
index 6deded0..3b1ba65 100644
--- a/Box42/Main/BoxViewController.swift
+++ b/Box42/Main/BoxViewController.swift
@@ -9,8 +9,7 @@ import Cocoa
import AppKit
import WebKit
-class BoxViewController: NSViewController {
-
+class BoxViewController: NSViewController {
var boxView: BoxBaseContainerViewController! = BoxBaseContainerViewController()
let preferencesVC = PreferencesViewController()
@@ -24,6 +23,7 @@ class BoxViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
+
menubarVCDelegate = (NSApplication.shared.delegate as? AppDelegate)?.menubarController
}
diff --git a/Box42/Menubar/MenubarViewController.swift b/Box42/Menubar/MenubarViewController.swift
index 0165ed7..df49987 100644
--- a/Box42/Menubar/MenubarViewController.swift
+++ b/Box42/Menubar/MenubarViewController.swift
@@ -6,7 +6,6 @@
//
import Foundation
-
import AppKit
class MenubarViewController: NSWorkspace {
@@ -16,7 +15,6 @@ class MenubarViewController: NSWorkspace {
lazy var eventMonitor: EventMonitor = self.setupEventMonitor()
var boxWindowController: BoxWindowController?
-
func menubarViewControllerInit() {
self.buttonInit()
}
diff --git a/Box42/Resources/Main.storyboard b/Box42/Resources/Main.storyboard
index 0a9696b..0fece80 100644
--- a/Box42/Resources/Main.storyboard
+++ b/Box42/Resources/Main.storyboard
@@ -3,7 +3,6 @@
-
@@ -173,53 +172,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Box42/System/EventMonitor.swift b/Box42/System/EventMonitor.swift
index 81234df..ecc7f8d 100644
--- a/Box42/System/EventMonitor.swift
+++ b/Box42/System/EventMonitor.swift
@@ -11,7 +11,7 @@ class EventMonitor {
private var monitor: Any?
private let mask: NSEvent.EventTypeMask
private let handler: (NSEvent?) -> Void
-
+
init(monitor: Any? = nil, mask: NSEvent.EventTypeMask, handler: @escaping (NSEvent?) -> Void) {
self.mask = mask
self.handler = handler
diff --git a/Box42/Window/BoxWindowController.swift b/Box42/Window/BoxWindowController.swift
index db80f60..acae3b9 100644
--- a/Box42/Window/BoxWindowController.swift
+++ b/Box42/Window/BoxWindowController.swift
@@ -8,13 +8,13 @@
import Cocoa
class BoxWindowController: NSWindowController {
-
override init(window: NSWindow?) {
let contentRect = BoxSizeManager.shared.boxViewSizeNSRect
let styleMask: NSWindow.StyleMask = [.titled, .closable, .resizable, .miniaturizable]
let windowInstance = NSWindow(contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false)
windowInstance.title = "Box"
windowInstance.styleMask.insert(.resizable)
+ windowInstance.backgroundColor = NSColor.red
let boxViewController = BoxViewController(nibName: nil, bundle: nil)
windowInstance.contentViewController = boxViewController