Skip to content

Commit 03b9b0e

Browse files
committed
Fixed SwiftLint errors and made a few adjustments
1 parent 29990f4 commit 03b9b0e

File tree

9 files changed

+38
-42
lines changed

9 files changed

+38
-42
lines changed

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3967,7 +3967,7 @@
39673967
attributes = {
39683968
BuildIndependentTargetsInParallel = 1;
39693969
LastSwiftUpdateCheck = 1330;
3970-
LastUpgradeCheck = 1540;
3970+
LastUpgradeCheck = 1620;
39713971
TargetAttributes = {
39723972
2BE487EB28245162003F3F64 = {
39733973
CreatedOnToolsVersion = 13.3.1;
@@ -4855,7 +4855,6 @@
48554855
isa = XCBuildConfiguration;
48564856
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
48574857
buildSettings = {
4858-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
48594858
ASSETCATALOG_COMPILER_APPICON_NAME = "${CE_APPICON_NAME}";
48604859
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
48614860
CODE_SIGN_ENTITLEMENTS = CodeEdit/CodeEdit.entitlements;
@@ -4895,7 +4894,6 @@
48954894
isa = XCBuildConfiguration;
48964895
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
48974896
buildSettings = {
4898-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
48994897
BUNDLE_LOADER = "$(TEST_HOST)";
49004898
CODE_SIGN_STYLE = Automatic;
49014899
COMBINE_HIDPI_IMAGES = YES;
@@ -4922,7 +4920,6 @@
49224920
isa = XCBuildConfiguration;
49234921
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
49244922
buildSettings = {
4925-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
49264923
CLANG_ENABLE_MODULES = YES;
49274924
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
49284925
CODE_SIGN_STYLE = Automatic;
@@ -5047,7 +5044,6 @@
50475044
isa = XCBuildConfiguration;
50485045
baseConfigurationReference = 28052DFD29730E0300F4F90A /* Beta.xcconfig */;
50495046
buildSettings = {
5050-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
50515047
ASSETCATALOG_COMPILER_APPICON_NAME = "${CE_APPICON_NAME}";
50525048
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
50535049
CODE_SIGN_ENTITLEMENTS = CodeEdit/CodeEdit.entitlements;
@@ -5087,7 +5083,6 @@
50875083
isa = XCBuildConfiguration;
50885084
baseConfigurationReference = 28052DFD29730E0300F4F90A /* Beta.xcconfig */;
50895085
buildSettings = {
5090-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
50915086
BUNDLE_LOADER = "$(TEST_HOST)";
50925087
CODE_SIGN_STYLE = Automatic;
50935088
COMBINE_HIDPI_IMAGES = YES;
@@ -5114,7 +5109,6 @@
51145109
isa = XCBuildConfiguration;
51155110
baseConfigurationReference = 28052DFD29730E0300F4F90A /* Beta.xcconfig */;
51165111
buildSettings = {
5117-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
51185112
CLANG_ENABLE_MODULES = YES;
51195113
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
51205114
CODE_SIGN_STYLE = Automatic;
@@ -5306,7 +5300,6 @@
53065300
isa = XCBuildConfiguration;
53075301
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
53085302
buildSettings = {
5309-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
53105303
ASSETCATALOG_COMPILER_APPICON_NAME = "${CE_APPICON_NAME}";
53115304
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
53125305
CE_APPICON_NAME = AppIconPre;
@@ -5347,7 +5340,6 @@
53475340
isa = XCBuildConfiguration;
53485341
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
53495342
buildSettings = {
5350-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
53515343
BUNDLE_LOADER = "$(TEST_HOST)";
53525344
CODE_SIGN_STYLE = Automatic;
53535345
COMBINE_HIDPI_IMAGES = YES;
@@ -5374,7 +5366,6 @@
53745366
isa = XCBuildConfiguration;
53755367
baseConfigurationReference = 28052DFC29730DF600F4F90A /* Alpha.xcconfig */;
53765368
buildSettings = {
5377-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
53785369
CLANG_ENABLE_MODULES = YES;
53795370
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
53805371
CODE_SIGN_STYLE = Automatic;
@@ -5568,7 +5559,6 @@
55685559
isa = XCBuildConfiguration;
55695560
baseConfigurationReference = 28052DFB29730DE300F4F90A /* Debug.xcconfig */;
55705561
buildSettings = {
5571-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
55725562
ASSETCATALOG_COMPILER_APPICON_NAME = "${CE_APPICON_NAME}";
55735563
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
55745564
CODE_SIGN_ENTITLEMENTS = CodeEdit/CodeEdit.entitlements;
@@ -5608,7 +5598,6 @@
56085598
isa = XCBuildConfiguration;
56095599
baseConfigurationReference = 28052DFE29730E0B00F4F90A /* Release.xcconfig */;
56105600
buildSettings = {
5611-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
56125601
ASSETCATALOG_COMPILER_APPICON_NAME = "${CE_APPICON_NAME}";
56135602
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
56145603
CODE_SIGN_ENTITLEMENTS = CodeEdit/CodeEdit.entitlements;
@@ -5648,7 +5637,6 @@
56485637
isa = XCBuildConfiguration;
56495638
baseConfigurationReference = 28052DFB29730DE300F4F90A /* Debug.xcconfig */;
56505639
buildSettings = {
5651-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
56525640
BUNDLE_LOADER = "$(TEST_HOST)";
56535641
CODE_SIGN_STYLE = Automatic;
56545642
COMBINE_HIDPI_IMAGES = YES;
@@ -5675,7 +5663,6 @@
56755663
isa = XCBuildConfiguration;
56765664
baseConfigurationReference = 28052DFE29730E0B00F4F90A /* Release.xcconfig */;
56775665
buildSettings = {
5678-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
56795666
BUNDLE_LOADER = "$(TEST_HOST)";
56805667
CODE_SIGN_STYLE = Automatic;
56815668
COMBINE_HIDPI_IMAGES = YES;
@@ -5702,7 +5689,6 @@
57025689
isa = XCBuildConfiguration;
57035690
baseConfigurationReference = 28052DFB29730DE300F4F90A /* Debug.xcconfig */;
57045691
buildSettings = {
5705-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
57065692
CLANG_ENABLE_MODULES = YES;
57075693
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
57085694
CODE_SIGN_STYLE = Automatic;
@@ -5731,7 +5717,6 @@
57315717
isa = XCBuildConfiguration;
57325718
baseConfigurationReference = 28052DFE29730E0B00F4F90A /* Release.xcconfig */;
57335719
buildSettings = {
5734-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
57355720
CLANG_ENABLE_MODULES = YES;
57365721
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
57375722
CODE_SIGN_STYLE = Automatic;

CodeEdit.xcodeproj/xcshareddata/xcschemes/CodeEdit.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1540"
3+
LastUpgradeVersion = "1620"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

CodeEdit/Features/Activities/ActivityManager.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Combine
1010
import SwiftUI
1111

1212
/// Manages activities for a workspace
13+
@MainActor
1314
final class ActivityManager: ObservableObject {
1415
/// Currently displayed activities
1516
@Published private(set) var activities: [CEActivity] = []
@@ -59,13 +60,13 @@ final class ActivityManager: ObservableObject {
5960
func update(
6061
id: String,
6162
title: String? = nil,
62-
message: String? = nil,
63+
message: String? = nil,
6364
percentage: Double? = nil,
6465
isLoading: Bool? = nil
6566
) {
6667
if let index = activities.firstIndex(where: { $0.id == id }) {
6768
var activity = activities[index]
68-
69+
6970
if let title = title {
7071
activity.title = title
7172
}
@@ -96,8 +97,9 @@ final class ActivityManager: ObservableObject {
9697
/// - id: ID of activity to delete
9798
/// - delay: Time to wait before deleting
9899
func delete(id: String, delay: TimeInterval) {
99-
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
100-
self?.delete(id: id)
100+
Task { @MainActor in
101+
try? await Task.sleep(for: .seconds(delay))
102+
delete(id: id)
101103
}
102104
}
103105
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
//
2+
// CEActivity.swift
3+
// CodeEdit
4+
//
5+
// Created by Austin Condiff on 2/20/25.
6+
//
7+
18
struct CEActivity: Equatable {
29
var id: String
310
var title: String
411
var message: String?
512
var percentage: Double?
613
var isLoading: Bool = false
7-
}
14+
}

CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class CodeEditSplitViewController: NSSplitViewController {
4141

4242
override func viewDidLoad() {
4343
super.viewDidLoad()
44-
guard let windowRef else {
44+
guard windowRef != nil else {
4545
// swiftlint:disable:next line_length
4646
assertionFailure("No WindowRef found, not initialized properly or the window was dereferenced and the controller was not.")
4747
return

CodeEdit/Features/Documents/WorkspaceDocument/WorkspaceDocument+Index.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ import Foundation
1010
extension WorkspaceDocument.SearchState {
1111
/// Adds the contents of the current workspace URL to the search index.
1212
/// That means that the contents of the workspace will be indexed and searchable.
13-
func addProjectToIndex() {
13+
func addProjectToIndex() async {
1414
guard let indexer = indexer else { return }
1515
guard let url = workspace.fileURL else { return }
1616

1717
indexStatus = .indexing(progress: 0.0)
18-
18+
1919
// Create activity using new API
20-
let activity = workspace.activityManager.post(
21-
title: "Indexing | Processing files",
22-
message: "Creating an index to enable fast and accurate searches within your codebase.",
23-
isLoading: true
24-
)
20+
let activity = await MainActor.run {
21+
workspace.activityManager.post(
22+
title: "Indexing | Processing files",
23+
message: "Creating an index to enable fast and accurate searches within your codebase.",
24+
isLoading: true
25+
)
26+
}
2527

2628
Task.detached {
2729
let filePaths = self.getFileURLs(at: url)
@@ -39,8 +41,7 @@ extension WorkspaceDocument.SearchState {
3941
await MainActor.run {
4042
self.indexStatus = .indexing(progress: progress)
4143
}
42-
// Update activity using new API
43-
self.workspace.activityManager.update(
44+
await self.workspace.activityManager.update(
4445
id: activity.id,
4546
percentage: progress
4647
)
@@ -51,15 +52,14 @@ extension WorkspaceDocument.SearchState {
5152
await MainActor.run {
5253
self.indexStatus = .done
5354
}
54-
55-
// Update and delete activity using new API
56-
self.workspace.activityManager.update(
55+
56+
await self.workspace.activityManager.update(
5757
id: activity.id,
5858
title: "Finished indexing",
5959
isLoading: false
6060
)
61-
62-
self.workspace.activityManager.delete(
61+
62+
await self.workspace.activityManager.delete(
6363
id: activity.id,
6464
delay: 4.0
6565
)

CodeEdit/Features/Documents/WorkspaceDocument/WorkspaceDocument+SearchState.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ extension WorkspaceDocument {
4747
init(_ workspace: WorkspaceDocument) {
4848
self.workspace = workspace
4949
self.indexer = SearchIndexer.Memory.create()
50-
addProjectToIndex()
50+
Task {
51+
await addProjectToIndex()
52+
}
5153
}
5254

5355
/// Represents the compare options to be used for find and replace.

CodeEdit/Features/InspectorArea/InternalDevelopmentInspector/InternalDevelopmentInspectorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import SwiftUI
99

1010
struct InternalDevelopmentInspectorView: View {
1111
@EnvironmentObject var activityManager: ActivityManager
12-
12+
1313
var body: some View {
1414
Form {
1515
InternalDevelopmentActivitiesView()

CodeEditTests/Features/Activities/ActivityManagerTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class ActivityManagerTests: XCTestCase {
4141

4242
func testUpdateTask() {
4343
let activity = activityManager.post(title: "Task Title")
44-
44+
4545
activityManager.update(
4646
id: activity.id,
4747
title: "Updated Task Title"
@@ -53,7 +53,7 @@ final class ActivityManagerTests: XCTestCase {
5353
func testDeleteTask() {
5454
let activity = activityManager.post(title: "Task Title")
5555
activityManager.delete(id: activity.id)
56-
56+
5757
XCTAssertTrue(activityManager.activities.isEmpty)
5858
}
5959

@@ -62,7 +62,7 @@ final class ActivityManagerTests: XCTestCase {
6262
activityManager.delete(id: activity.id, delay: 0.2)
6363

6464
XCTAssertFalse(activityManager.activities.isEmpty)
65-
65+
6666
let expectation = XCTestExpectation()
6767
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
6868
XCTAssertTrue(self.activityManager.activities.isEmpty)

0 commit comments

Comments
 (0)