Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
jobs:
markedit-mac:
name: MarkEditMac
runs-on: macos-26
runs-on: macos-27
if: github.event.pull_request.draft == false
env:
node-version: '22.x'
DEVELOPER_DIR: /Applications/Xcode_26.5.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_27.0.app/Contents/Developer

defaults:
run:
Expand Down
16 changes: 8 additions & 8 deletions MarkEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1112,7 +1112,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -1151,7 +1151,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited)";
PRODUCT_NAME = MarkEdit;
Expand Down Expand Up @@ -1188,7 +1188,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited)";
PRODUCT_NAME = MarkEdit;
Expand Down Expand Up @@ -1230,7 +1230,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).finder-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1276,7 +1276,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).finder-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1309,7 +1309,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).preview-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1340,7 +1340,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).preview-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
6 changes: 3 additions & 3 deletions MarkEditCore/Package.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MarkEditCore",
platforms: [
.iOS(.v18),
.macOS(.v15),
.iOS(.v26),
.macOS(.v26),
],
products: [
.library(
Expand Down
6 changes: 3 additions & 3 deletions MarkEditKit/Package.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MarkEditKit",
platforms: [
.iOS(.v18),
.macOS(.v15),
.iOS(.v26),
.macOS(.v26),
],
products: [
.library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
}

public func createSession(instructions: String?) async -> String? {
guard #available(macOS 26.0, *) else {
return nil
}

let identifier = UUID().uuidString
let session = LanguageModelSession(instructions: instructions)

Expand All @@ -41,7 +37,7 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
}

public func isResponding(sessionID: String?) async -> Bool {
guard #available(macOS 26.0, *), let session = session(with: sessionID) else {
guard let session = session(with: sessionID) else {
return false
}

Expand All @@ -61,7 +57,7 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
).jsonEncoded
}

guard #available(macOS 26.0, *), let session = session(with: sessionID) else {
guard let session = session(with: sessionID) else {
return encode(nil, "Model Unavailable", true)
}

Expand Down Expand Up @@ -103,7 +99,7 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
}
}

guard #available(macOS 26.0, *), let session = session(with: sessionID) else {
guard let session = session(with: sessionID) else {
return didReceive(nil, "Model Unavailable", true)
}

Expand All @@ -129,10 +125,6 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
// MARK: - Private

private var defaultModelAvailability: LanguageModelAvailability {
guard #available(macOS 26.0, *) else {
return LanguageModelAvailability(isAvailable: false, unavailableReason: "Unsupported OS Version")
}

switch SystemLanguageModel.default.availability {
case .available:
return LanguageModelAvailability(isAvailable: true, unavailableReason: nil)
Expand All @@ -147,12 +139,10 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {
}
}

// [macOS 26] Change the value type to LanguageModelSession
private var sessionPool = [String: AnyObject]()
private var sessionPool = [String: LanguageModelSession]()

@available(macOS 26.0, *)
private func session(with sessionID: String?) -> LanguageModelSession? {
guard let sessionID, let session = (sessionPool[sessionID] as? LanguageModelSession) else {
guard let sessionID, let session = sessionPool[sessionID] else {
return nil
}

Expand All @@ -162,7 +152,6 @@ public final class EditorModuleFoundationModels: NativeModuleFoundationModels {

// MARK: - Private

@available(macOS 26.0, *)
private extension GenerationOptions {
init(_ options: LanguageModelGenerationOptions?) {
#if canImport(FoundationModels, _version: 2)
Expand All @@ -181,7 +170,6 @@ private extension GenerationOptions {
}
}

@available(macOS 26.0, *)
private extension GenerationOptions.SamplingMode {
init?(_ sampling: LanguageModelSampling?) {
if sampling?.greedy == true {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public final class EditorModuleTranslation: NativeModuleTranslation {
public init() {}

public func translate(text: String, from: String?, to: String?) async -> String {
guard #available(macOS 26.0, *) else {
return TranslationResponse(error: "Unsupported OS Version").jsonEncoded
}

do {
let from = from ?? NLLanguageRecognizer.dominantLanguage(for: text)?.rawValue ?? "en-US"
let session = TranslationSession(from: from, to: to)
Expand All @@ -41,7 +37,6 @@ private struct TranslationResponse: Encodable {
}
}

@available(macOS 26.0, *)
private extension TranslationSession {
convenience init(from: String, to: String?) {
self.init(
Expand Down
4 changes: 2 additions & 2 deletions MarkEditMac/Modules/Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Modules",
platforms: [
.macOS(.v15),
.macOS(.v26),
],
products: [
.library(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import AppKitExtensions
public class NonBezelButton: NSButton {
public var focusRingRadius: Double?
public var focusRingCorners: NSBezierPath.Corners?
public var modernStyle = false
public var modernCornerRadius: Double = 0
public var modernStateChanged: ((_ isHighlighted: Bool) -> Void)?

Expand All @@ -31,31 +30,18 @@ public class NonBezelButton: NSButton {
let rectPath = NSBezierPath(rect: bounds)
rectPath.fill()

// Classic style:
// - Default: clear background
// - Highlighted: light gray background
//
// Modern style:
// - Default: light gray background
// - Highlighted: slightly darker light gray, rounded corner

if modernStyle {
modernStateChanged?(isHighlighted)
NSColor.modernButtonBackground.setFill()
rectPath.fill()
}
modernStateChanged?(isHighlighted)
NSColor.modernButtonBackground.setFill()
rectPath.fill()

if isHighlighted {
if modernStyle {
NSBezierPath(
roundedRect: bounds,
xRadius: modernCornerRadius,
yRadius: modernCornerRadius
).fill()
} else {
NSColor.plainButtonHighlighted.setFill()
rectPath.fill()
}
NSBezierPath(
roundedRect: bounds,
xRadius: modernCornerRadius,
yRadius: modernCornerRadius
).fill()
}
}

Expand Down
32 changes: 11 additions & 21 deletions MarkEditMac/Modules/Sources/AppKitControls/LabeledSearchField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import AppKit
import AppKitExtensions

public final class LabeledSearchField: NSSearchField {
private let modernStyle: Bool
private let bezelView = BezelView(cornerRadius: Constants.bezelCornerRadius)

// To render custom icons in modern style due to the unwanted bezel added by Apple
Expand All @@ -27,8 +26,7 @@ public final class LabeledSearchField: NSSearchField {
return label
}()

public init(modernStyle: Bool) {
self.modernStyle = modernStyle
public init() {
super.init(frame: .zero)

usesSingleLineMode = false
Expand Down Expand Up @@ -64,16 +62,14 @@ public final class LabeledSearchField: NSSearchField {
)
}

if modernStyle {
// To completely remove the unnecessary capsule-style border
if let view = modernBezelView {
renderCustomIcons(modernBezel: view)
} else if #unavailable(macOS 27.0) {
// [macOS 27] Revisit this later
#if DEBUG
assertionFailure("Missing AppKitSearchField in NSSearchField")
#endif
}
// To completely remove the unnecessary capsule-style border
if let view = modernBezelView {
renderCustomIcons(modernBezel: view)
} else if #unavailable(macOS 27.0) {
// [macOS 27] Revisit this later
#if DEBUG
assertionFailure("Missing AppKitSearchField in NSSearchField")
#endif
}
}

Expand Down Expand Up @@ -121,10 +117,8 @@ public final class LabeledSearchField: NSSearchField {
buttonCell?.image = nil
buttonCell?.image = iconImage

if modernStyle {
searchIconView.image = nil
searchIconView.image = iconImage
}
searchIconView.image = nil
searchIconView.image = iconImage

needsDisplay = true
}
Expand Down Expand Up @@ -159,10 +153,6 @@ private extension LabeledSearchField {
}

func updateCustomCancelIcon() {
guard modernStyle else {
return
}

cancelIconView.isHidden = stringValue.isEmpty
}

Expand Down
Loading