Skip to content

Commit 95c4401

Browse files
Use isNotEmpty from Bedrock
1 parent 2e47e88 commit 95c4401

File tree

11 files changed

+62
-27
lines changed

11 files changed

+62
-27
lines changed

.swiftlint.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type_body_length:
1919
file_length:
2020
warning: 500
2121
error: 1200
22-
2322
type_name:
2423
min_length: 3
2524
max_length:
@@ -39,4 +38,11 @@ identifier_name:
3938
- id
4039
- URL
4140

42-
reporter: "xcode"
41+
custom_rules:
42+
prefer_is_not_empty:
43+
name: "Prefer Bedrock isNotEmpty"
44+
regex: "(\\![a-zA-Z0-9\\_\\.]+\\.isEmpty)"
45+
capture_group: 0
46+
message: "Prefer to use the isNotEmpty property from Bedrock."
47+
severity: warning
48+
reporter: "xcode"

Alidade.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MCMaps.xcodeproj/project.pbxproj

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
9500D89C2F1229FA00B4A633 /* Bedrock in Frameworks */ = {isa = PBXBuildFile; productRef = 9500D89B2F1229FA00B4A633 /* Bedrock */; };
11+
9500D89E2F1229FA00B4A633 /* BedrockUI in Frameworks */ = {isa = PBXBuildFile; productRef = 9500D89D2F1229FA00B4A633 /* BedrockUI */; };
1012
9504030F2D4D7E0A00F51903 /* CubiomesKit in Frameworks */ = {isa = PBXBuildFile; productRef = 9504030E2D4D7E0A00F51903 /* CubiomesKit */; };
1113
95141F562F0874D200DAF47D /* DocumentKit in Frameworks */ = {isa = PBXBuildFile; productRef = 95141F552F0874D200DAF47D /* DocumentKit */; };
1214
951FE2BC2D5937630091BE11 /* ViewInspector in Frameworks */ = {isa = PBXBuildFile; productRef = 951FE2BB2D5937630091BE11 /* ViewInspector */; };
@@ -69,10 +71,12 @@
6971
buildActionMask = 2147483647;
7072
files = (
7173
9504030F2D4D7E0A00F51903 /* CubiomesKit in Frameworks */,
74+
9500D89E2F1229FA00B4A633 /* BedrockUI in Frameworks */,
7275
955A44382D8F47C600262A6D /* AdaptableSidebarSheetView in Frameworks */,
7376
95FB72D02DE255630003CC61 /* AlidadeUI in Frameworks */,
7477
956603732EA588CC0049C15D /* AlidadeSearchEngine in Frameworks */,
7578
955CD1652DAAE1BE007F6FA1 /* CubiomesKit in Frameworks */,
79+
9500D89C2F1229FA00B4A633 /* Bedrock in Frameworks */,
7680
955A4D682D932A6500262A6D /* DesignLibrary in Frameworks */,
7781
95141F562F0874D200DAF47D /* DocumentKit in Frameworks */,
7882
95F6B0AD2DADE504006A1B8C /* AsyncAlgorithms in Frameworks */,
@@ -143,6 +147,8 @@
143147
956603722EA588CC0049C15D /* AlidadeSearchEngine */,
144148
95141F552F0874D200DAF47D /* DocumentKit */,
145149
95317F2D2F0B0FB9007BCDA0 /* ImageProcessing */,
150+
9500D89B2F1229FA00B4A633 /* Bedrock */,
151+
9500D89D2F1229FA00B4A633 /* BedrockUI */,
146152
);
147153
productName = MCMaps;
148154
productReference = 950402CF2D4D522100F51903 /* Alidade.app */;
@@ -214,6 +220,7 @@
214220
956603712EA588CC0049C15D /* XCRemoteSwiftPackageReference "searchengine" */,
215221
95141F542F0874D200DAF47D /* XCRemoteSwiftPackageReference "DocumentKit" */,
216222
95317F2C2F0B0FB9007BCDA0 /* XCRemoteSwiftPackageReference "imageprocessing" */,
223+
9500D89A2F1229FA00B4A633 /* XCRemoteSwiftPackageReference "bedrock" */,
217224
);
218225
preferredProjectObjectVersion = 77;
219226
productRefGroup = 950402D02D4D522100F51903 /* Products */;
@@ -635,6 +642,14 @@
635642
/* End XCLocalSwiftPackageReference section */
636643

637644
/* Begin XCRemoteSwiftPackageReference section */
645+
9500D89A2F1229FA00B4A633 /* XCRemoteSwiftPackageReference "bedrock" */ = {
646+
isa = XCRemoteSwiftPackageReference;
647+
repositoryURL = "https://source.marquiskurt.net/marquiskurt/bedrock";
648+
requirement = {
649+
branch = main;
650+
kind = branch;
651+
};
652+
};
638653
95141F542F0874D200DAF47D /* XCRemoteSwiftPackageReference "DocumentKit" */ = {
639654
isa = XCRemoteSwiftPackageReference;
640655
repositoryURL = "https://source.marquiskurt.net/marquiskurt/DocumentKit";
@@ -710,6 +725,16 @@
710725
/* End XCRemoteSwiftPackageReference section */
711726

712727
/* Begin XCSwiftPackageProductDependency section */
728+
9500D89B2F1229FA00B4A633 /* Bedrock */ = {
729+
isa = XCSwiftPackageProductDependency;
730+
package = 9500D89A2F1229FA00B4A633 /* XCRemoteSwiftPackageReference "bedrock" */;
731+
productName = Bedrock;
732+
};
733+
9500D89D2F1229FA00B4A633 /* BedrockUI */ = {
734+
isa = XCSwiftPackageProductDependency;
735+
package = 9500D89A2F1229FA00B4A633 /* XCRemoteSwiftPackageReference "bedrock" */;
736+
productName = BedrockUI;
737+
};
713738
9504030E2D4D7E0A00F51903 /* CubiomesKit */ = {
714739
isa = XCSwiftPackageProductDependency;
715740
productName = CubiomesKit;

MCMaps/Red Window/Views/Detail/Cells/RedWindowPinGalleryCell.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 19-06-2025.
66
//
77

8+
import Bedrock
89
import ImageProcessing
910
import MCMap
1011
import SwiftUI
@@ -41,7 +42,7 @@ struct RedWindowPinGalleryCell: RedWindowDetailCell {
4142
.bold()
4243
.padding(.top)
4344
.fontDesign(.serif)
44-
if let images = pin.images, !images.isEmpty {
45+
if let images = pin.images, images.isNotEmpty {
4546
ScrollView(.horizontal) {
4647
HStack {
4748
ForEach(Array(images), id: \.self) { image in

MCMaps/Red Window/Views/Detail/Cells/RedWindowPinTagsCell.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 19-06-2025.
66
//
77

8+
import Bedrock
89
import MCMap
910
import SwiftUI
1011

@@ -28,7 +29,7 @@ struct RedWindowPinTagsCell: RedWindowDetailCell {
2829
.font(.system(.title3, design: .serif))
2930
.bold()
3031
.padding(.top)
31-
if let tags = pin.tags, !tags.isEmpty {
32+
if let tags = pin.tags, tags.isNotEmpty {
3233
ScrollView(.horizontal) {
3334
HStack {
3435
ForEach(Array(tags), id: \.self) { tag in

MCMaps/Red Window/Views/Detail/RedWindowPinDetailView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 15-06-2025.
66
//
77

8+
import Bedrock
89
import CubiomesKit
910
import MCMap
1011
import PhotosUI
@@ -61,7 +62,7 @@ struct RedWindowPinDetailView: View {
6162
Group {
6263
RedWindowDescriptionCell(pin: $pin, isEditing: $editMode, file: $file)
6364
if !editMode {
64-
if !tags.isEmpty {
65+
if tags.isNotEmpty {
6566
RedWindowPinTagsCell(pin: $pin, isEditing: $editMode, file: $file)
6667
}
6768
RedWindowPositionCell(pin: $pin, isEditing: $editMode, file: $file)

MCMaps/Red Window/Views/Library/RedWindowPinLibraryListView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 16-06-2025.
66
//
77

8+
import Bedrock
89
import CubiomesKit
910
import MCMap
1011
import SwiftUI
@@ -56,7 +57,7 @@ struct RedWindowPinLibraryListView: View {
5657
TableColumn("Dimension", value: \.content.dimension.rawValue.localizedCapitalized)
5758
TableColumn("Tags") { val in
5859
Group {
59-
if let tags = val.content.tags, !tags.isEmpty {
60+
if let tags = val.content.tags, tags.isNotEmpty {
6061
ViewThatFits {
6162
HStack {
6263
ForEach(Array(tags), id: \.self) { tag in

MCMaps/Red Window/Views/RedWindowTagForm.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Marquis Kurt on 19-06-2025.
66
//
77

8+
import Bedrock
89
import SwiftUI
910

1011
struct RedWindowTagForm: View {
@@ -23,7 +24,7 @@ struct RedWindowTagForm: View {
2324
HStack {
2425
TextField("Create Tag", text: $tagToAdd, prompt: Text("Tag Name"))
2526
.onSubmit(submitTag)
26-
if !tagToAdd.isEmpty {
27+
if tagToAdd.isNotEmpty {
2728
Button("Create", action: submitTag)
2829
}
2930
}
@@ -58,7 +59,7 @@ struct RedWindowTagForm: View {
5859
.toolbar {
5960
#if os(iOS)
6061
ToolbarItem {
61-
if !tags.isEmpty {
62+
if tags.isNotEmpty {
6263
EditButton()
6364
}
6465
}

MCMaps/Shared/Extensions/CGPoint+Manhattan.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88
import Foundation
99

1010
extension CGPoint {
11-
/// Returns the distance between two points using the Manhattan/taxicab algorithm.
12-
///
13-
/// This is typically used to calculate the distance between two locations by a measure of Minecraft blocks rather
14-
/// than a raw distance.
15-
///
16-
/// - Parameter other: The endpoint to get the distance to from the current point.
17-
func manhattanDistance(to other: CGPoint) -> Double {
18-
let deltaX = self.x - other.x
19-
let deltaY = self.y - other.y
20-
return abs(deltaX) + abs(deltaY)
21-
}
22-
2311
/// A human-readable readout for accessibility purposes.
2412
var accessibilityReadout: String {
2513
let xVal = Int(x)

MCMaps/Shared/Extensions/MCMapsApp+AppProperties.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
// Created by Marquis Kurt on 13-06-2025.
66
//
77

8+
import Bedrock
89
import SwiftUI
910

1011
extension MCMapsApp {
1112
/// The app's display name as it appears in the Info.plist file.
1213
static var appName: String {
13-
Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String ?? ""
14+
Bundle.main.appInformation?.name ?? ""
1415
}
1516

1617
/// The app's main version as it appears in the Info.plist file.
1718
static var version: String {
18-
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.0"
19+
Bundle.main.appInformation?.version ?? "0.0"
1920
}
2021

2122
/// The app's build number as it appears in the Info.plist file.
2223
static var buildNumber: String {
23-
Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "0"
24+
Bundle.main.appInformation?.buildNumber ?? "0"
2425
}
2526

2627
static var copyrightString: String {
27-
Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? ""
28+
Bundle.main.appInformation?.copyrightString as? String ?? ""
2829
}
2930
}

0 commit comments

Comments
 (0)