Skip to content

Commit

Permalink
Merge pull request #1698 from planetary-social/xcode-16
Browse files Browse the repository at this point in the history
Fix build in Xcode 16
  • Loading branch information
joshuatbrown authored Dec 16, 2024
2 parents 1a00507 + 920ad6b commit 45b90a4
Show file tree
Hide file tree
Showing 60 changed files with 339 additions and 263 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
push:
branches: main
env:
SIMULATOR: platform=iOS Simulator,name=iPhone 15,OS=17.4
SIMULATOR: platform=iOS Simulator,name=iPhone 16,OS=18.1

jobs:
unit_test:
Expand All @@ -38,6 +38,6 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: SwiftLint
uses: docker://norionomura/swiftlint:0.55.1
uses: docker://norionomura/swiftlint:0.57.1
with:
args: swiftlint --strict --reporter github-actions-logging
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.4
16.1
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nos now publishes the hashtags it finds in your note when you post. This means it works the way you’ve always expected it to work. [#44](https://github.com/verse-pbc/issues/issues/44)

### Internal Changes
- Upgraded to Xcode 16. [#1570](https://github.com/planetary-social/nos/issues/1570)

## [1.0.3] - 2024-12-04Z

Expand Down
24 changes: 12 additions & 12 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
030036852C5D39DD002C71F5 /* RefreshController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030036842C5D39DD002C71F5 /* RefreshController.swift */; };
030036942C5D3AD3002C71F5 /* RefreshController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030036842C5D39DD002C71F5 /* RefreshController.swift */; };
030036AB2C5D872B002C71F5 /* NewNotesButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030036AA2C5D872B002C71F5 /* NewNotesButton.swift */; };
0301495C2CFFA8B7000A0152 /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0301495B2CFFA8B7000A0152 /* TabBarController.swift */; };
0304D0A72C9B4BF2001D16C7 /* OpenGraphMetatdata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0304D0A62C9B4BF2001D16C7 /* OpenGraphMetatdata.swift */; };
0304D0A82C9B4BF2001D16C7 /* OpenGraphMetatdata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0304D0A62C9B4BF2001D16C7 /* OpenGraphMetatdata.swift */; };
0304D0B22C9B731F001D16C7 /* MockOpenGraphService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0304D0B12C9B731F001D16C7 /* MockOpenGraphService.swift */; };
Expand Down Expand Up @@ -132,6 +133,8 @@
03ED93472C46C48400C8D443 /* JSONEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03ED93462C46C48400C8D443 /* JSONEventTests.swift */; };
03F7C4F32C10DF79006FF613 /* URLSessionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F7C4F22C10DF79006FF613 /* URLSessionProtocol.swift */; };
03F7C4F42C10E05B006FF613 /* URLSessionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F7C4F22C10DF79006FF613 /* URLSessionProtocol.swift */; };
03F866692CF7D39900527C39 /* Foundation+Sendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F866682CF7D39900527C39 /* Foundation+Sendable.swift */; };
03F8666A2CF7D39900527C39 /* Foundation+Sendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F866682CF7D39900527C39 /* Foundation+Sendable.swift */; };
03FE3F792C87A9D900D25810 /* EventError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03FE3F782C87A9D900D25810 /* EventError.swift */; };
03FE3F7A2C87A9DC00D25810 /* EventError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03FE3F782C87A9D900D25810 /* EventError.swift */; };
03FE3F7C2C87AC9900D25810 /* Event+InlineMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03FE3F7B2C87AC9900D25810 /* Event+InlineMetadata.swift */; };
Expand Down Expand Up @@ -467,8 +470,6 @@
C9B5C78E2C24AF650070445B /* MockRelaySubscriptionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0320C1142BFE63DC00C4C080 /* MockRelaySubscriptionManager.swift */; };
C9B678DB29EEBF3B00303F33 /* DependencyInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678DA29EEBF3B00303F33 /* DependencyInjection.swift */; };
C9B678DC29EEBF3B00303F33 /* DependencyInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678DA29EEBF3B00303F33 /* DependencyInjection.swift */; };
C9B678DE29EEC35B00303F33 /* Foundation+Sendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678DD29EEC35B00303F33 /* Foundation+Sendable.swift */; };
C9B678DF29EEC35B00303F33 /* Foundation+Sendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678DD29EEC35B00303F33 /* Foundation+Sendable.swift */; };
C9B678E129EEC41000303F33 /* SocialGraphCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678E029EEC41000303F33 /* SocialGraphCache.swift */; };
C9B678E229EEC41000303F33 /* SocialGraphCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678E029EEC41000303F33 /* SocialGraphCache.swift */; };
C9B678E729F01A8500303F33 /* FullscreenProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B678E629F01A8500303F33 /* FullscreenProgressView.swift */; };
Expand Down Expand Up @@ -603,6 +604,7 @@
030024182CC00DF70073ED56 /* SplashScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashScreenView.swift; sourceTree = "<group>"; };
030036842C5D39DD002C71F5 /* RefreshController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshController.swift; sourceTree = "<group>"; };
030036AA2C5D872B002C71F5 /* NewNotesButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewNotesButton.swift; sourceTree = "<group>"; };
0301495B2CFFA8B7000A0152 /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
0304D0A62C9B4BF2001D16C7 /* OpenGraphMetatdata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenGraphMetatdata.swift; sourceTree = "<group>"; };
0304D0B12C9B731F001D16C7 /* MockOpenGraphService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockOpenGraphService.swift; sourceTree = "<group>"; };
030AE4282BE3D63C004DEE02 /* FeaturedAuthor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturedAuthor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -693,6 +695,7 @@
03EB47062CB080110004FF35 /* BrokenLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrokenLinkView.swift; sourceTree = "<group>"; };
03ED93462C46C48400C8D443 /* JSONEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEventTests.swift; sourceTree = "<group>"; };
03F7C4F22C10DF79006FF613 /* URLSessionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionProtocol.swift; sourceTree = "<group>"; };
03F866682CF7D39900527C39 /* Foundation+Sendable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Foundation+Sendable.swift"; sourceTree = "<group>"; };
03FE3F782C87A9D900D25810 /* EventError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventError.swift; sourceTree = "<group>"; };
03FE3F7B2C87AC9900D25810 /* Event+InlineMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Event+InlineMetadata.swift"; sourceTree = "<group>"; };
03FE3F8A2C87BC9500D25810 /* text_note_multiple_media.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = text_note_multiple_media.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -943,7 +946,6 @@
C9ADB14029951CB10075E7F8 /* NSManagedObject+Nos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Nos.swift"; sourceTree = "<group>"; };
C9B597642BBC8300002EC76A /* ImagePickerUIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImagePickerUIViewController.swift; sourceTree = "<group>"; };
C9B678DA29EEBF3B00303F33 /* DependencyInjection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyInjection.swift; sourceTree = "<group>"; };
C9B678DD29EEC35B00303F33 /* Foundation+Sendable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Foundation+Sendable.swift"; sourceTree = "<group>"; };
C9B678E029EEC41000303F33 /* SocialGraphCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialGraphCache.swift; sourceTree = "<group>"; };
C9B678E629F01A8500303F33 /* FullscreenProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullscreenProgressView.swift; sourceTree = "<group>"; };
C9B708BA2A13BE41006C613A /* NoteTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteTextEditor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1872,22 +1874,22 @@
C9F84C1B298DBBF400C6714D /* Data+Sha.swift */,
C942566829B66A2800C4202C /* Date+Elapsed.swift */,
C987F85729BA981800B44E7A /* Font+Clarity.swift */,
C9B678DD29EEC35B00303F33 /* Foundation+Sendable.swift */,
03F866682CF7D39900527C39 /* Foundation+Sendable.swift */,
C9F0BB6829A5039D000547FC /* Int+Bool.swift */,
C9ADB14029951CB10075E7F8 /* NSManagedObject+Nos.swift */,
C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */,
508B2B602C9EF65300C14034 /* NSPersistentContainer+Nos.swift */,
C93EC2F329C34C860012EE2A /* NSPredicate+Bool.swift */,
50E2EB712C86175900D4B360 /* NSRegularExpression+Replacement.swift */,
C93EC2F629C351470012EE2A /* Optional+Unwrap.swift */,
045EDD042CAC025700B67964 /* ScrollViewProxy+Animate.swift */,
C99721CA2AEBED26004EBEAB /* String+Empty.swift */,
C9ADB13729928CC30075E7F8 /* String+Hex.swift */,
C9DEC002298945150078B43A /* String+Lorem.swift */,
C98A32262A05795E00E3FA13 /* Task+Timeout.swift */,
DC2E54C72A700F1400C2CAAB /* UIDevice+Simulator.swift */,
C92DF80429C25DE900400561 /* URL+Extensions.swift */,
C9C2B77B29E072E400548B4A /* WebSocket+Nos.swift */,
045EDD042CAC025700B67964 /* ScrollViewProxy+Animate.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -2001,6 +2003,7 @@
children = (
C9F84C20298DC36800C6714D /* AppView.swift */,
030024182CC00DF70073ED56 /* SplashScreenView.swift */,
0301495B2CFFA8B7000A0152 /* TabBarController.swift */,
5B79F6402BA11618002DA9BE /* Components */,
65BD8DC12BDAF2C300802039 /* Discover */,
03618B112C825D8700BCBC55 /* Fixtures */,
Expand Down Expand Up @@ -2121,7 +2124,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1530;
LastUpgradeCheck = 1610;
TargetAttributes = {
C90862BA29E9804B00C35A71 = {
CreatedOnToolsVersion = 14.2;
Expand Down Expand Up @@ -2333,7 +2336,6 @@
50089A0C2C97182200834588 /* CurrentUser+PublishEvents.swift in Sources */,
C97A1C8E29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift in Sources */,
5BBA5E9C2BAE052F00D57D76 /* NiceWorkSheet.swift in Sources */,
C9B678DE29EEC35B00303F33 /* Foundation+Sendable.swift in Sources */,
5B88051A2A21027C00E21F06 /* SHA256Key.swift in Sources */,
C9B71DC22A9003670031ED9F /* CrashReporting.swift in Sources */,
C987F81729BA4C6A00B44E7A /* BigActionButton.swift in Sources */,
Expand Down Expand Up @@ -2451,6 +2453,8 @@
C9F84C27298DC98800C6714D /* KeyPair.swift in Sources */,
5B8C96B629DDD3B200B73AEC /* NoteUITextViewRepresentable.swift in Sources */,
C93EC2F129C337EB0012EE2A /* RelayPicker.swift in Sources */,
0301495C2CFFA8B7000A0152 /* TabBarController.swift in Sources */,
03F866692CF7D39900527C39 /* Foundation+Sendable.swift in Sources */,
5BBA5E912BADF98E00D57D76 /* AlreadyHaveANIP05View.swift in Sources */,
C9F0BB6F29A50437000547FC /* NostrIdentifierPrefix.swift in Sources */,
C96D39272B61B6D200D3D0A1 /* RawNostrID.swift in Sources */,
Expand Down Expand Up @@ -2690,7 +2694,6 @@
03E711672C935114000B6F96 /* SoupOpenGraphParserTests.swift in Sources */,
C9C5475C2A4F1D8C006B0741 /* NosNotification+CoreDataProperties.swift in Sources */,
03C49AC32C938DE100502321 /* SoupOpenGraphParser.swift in Sources */,
C9B678DF29EEC35B00303F33 /* Foundation+Sendable.swift in Sources */,
03EB470C2CB080180004FF35 /* BrokenLinkView.swift in Sources */,
A3B943D7299D6DB700A15A08 /* Follow+CoreDataClass.swift in Sources */,
C9ADB13E29929EEF0075E7F8 /* Bech32.swift in Sources */,
Expand Down Expand Up @@ -2748,6 +2751,7 @@
C9DEC06F2989668E0078B43A /* Relay+CoreDataClass.swift in Sources */,
C9ADB13F29929F1F0075E7F8 /* String+Hex.swift in Sources */,
500899F32C95C1F900834588 /* PushNotificationRegistrar.swift in Sources */,
03F8666A2CF7D39900527C39 /* Foundation+Sendable.swift in Sources */,
C973AB622A323167002AED16 /* Author+CoreDataProperties.swift in Sources */,
C93EC2F529C34C860012EE2A /* NSPredicate+Bool.swift in Sources */,
C9DEC05B298950A90078B43A /* String+Lorem.swift in Sources */,
Expand Down Expand Up @@ -2947,7 +2951,6 @@
5B7888CD2B5A0FB800B6761F /* Staging */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
CODE_SIGN_STYLE = Automatic;
Expand Down Expand Up @@ -3121,7 +3124,6 @@
5BE460732BAB3028004B83ED /* Dev */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
CODE_SIGN_STYLE = Automatic;
Expand Down Expand Up @@ -3449,7 +3451,6 @@
C9DEBFFC298941020078B43A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
CODE_SIGN_STYLE = Automatic;
Expand Down Expand Up @@ -3479,7 +3480,6 @@
C9DEBFFD298941020078B43A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
CODE_SIGN_STYLE = Automatic;
Expand Down
2 changes: 1 addition & 1 deletion Nos.xcodeproj/xcshareddata/xcschemes/Nos.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Nos.xcodeproj/xcshareddata/xcschemes/NosStaging.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Nos.xcodeproj/xcshareddata/xcschemes/NosTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Nos.xcodeproj/xcshareddata/xcschemes/NosUITests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions Nos/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Dependencies
import SDWebImage
import SDWebImageWebPCoder

@MainActor
class AppDelegate: NSObject, UIApplicationDelegate {

@Dependency(\.currentUser) private var currentUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
3 changes: 3 additions & 0 deletions Nos/Assets/Assets.xcassets/tab-profile.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
2 changes: 1 addition & 1 deletion Nos/Controller/RawEventController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protocol RawEventViewModel {
withJSONObject: note.jsonRepresentation ?? [:],
options: [.prettyPrinted]
)
rawMessage = String(decoding: data, as: UTF8.self)
rawMessage = String(data: data, encoding: .utf8) ?? "error"
} catch {
rawMessage = note.content ?? "error"
}
Expand Down
3 changes: 1 addition & 2 deletions Nos/Extensions/Foundation+Sendable.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Foundation

extension UserDefaults: @unchecked Sendable {}
extension AttributedString: @unchecked Sendable {}
extension UserDefaults: @unchecked @retroactive Sendable {}
14 changes: 14 additions & 0 deletions Nos/Models/AppDestination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ enum AppDestination: Hashable, Equatable {
case noteComposer(String?)
case profile

static var tabDestinations: [AppDestination] {
[.home, .discover, .noteComposer(nil), .notifications, .profile]
}

var destinationString: String {
switch self {
case .home:
Expand All @@ -27,4 +31,14 @@ enum AppDestination: Hashable, Equatable {
func hash(into hasher: inout Hasher) {
hasher.combine(destinationString)
}

var tabIndex: Int {
switch self {
case .home: return 0
case .discover: return 1
case .noteComposer: return 2
case .notifications: return 3
case .profile: return 4
}
}
}
2 changes: 1 addition & 1 deletion Nos/Models/CoreData/Event+CoreDataClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public class Event: NosManagedObject, VerifiableEvent {
let data = try? JSONSerialization.data(withJSONObject: jsonRepresentation) else {
return nil
}
return String(decoding: data, as: UTF8.self)
return String(data: data, encoding: .utf8)
}

var codable: JSONEvent? {
Expand Down
7 changes: 5 additions & 2 deletions Nos/Models/JSONEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct JSONEvent: Codable, Hashable, VerifiableEvent {
func toJSON() throws -> String? {
let encoder = JSONEncoder()
let data = try encoder.encode(self)
return String(decoding: data, as: UTF8.self)
return String(data: data, encoding: .utf8)
}

mutating func sign(withKey privateKey: KeyPair) throws {
Expand Down Expand Up @@ -164,7 +164,10 @@ struct JSONEvent: Codable, Hashable, VerifiableEvent {
func buildPublishRequest() throws -> String {
let request: [Any] = ["EVENT", dictionary]
let requestData = try JSONSerialization.data(withJSONObject: request)
return String(decoding: requestData, as: UTF8.self)
guard let requestString = String(data: requestData, encoding: .utf8) else {
throw RelayError.parseError
}
return requestString
}
}

Expand Down
4 changes: 2 additions & 2 deletions Nos/Models/KeyPair.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ extension KeyPair: RawRepresentable {
}

public var rawValue: String {
guard let data = try? JSONEncoder().encode(self) else {
guard let data = try? JSONEncoder().encode(self), let string = String(data: data, encoding: .utf8) else {
return "{}"
}
return String(decoding: data, as: UTF8.self)
return string
}
}
6 changes: 4 additions & 2 deletions Nos/Models/OpenGraph/SoupOpenGraphParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import SwiftSoup
/// Parses the Open Graph metadata from an HTML document using SwiftSoup.
struct SoupOpenGraphParser: OpenGraphParser {
func metadata(html: Data) -> OpenGraphMetadata? {
let htmlString = String(decoding: html, as: UTF8.self)
guard let document = try? SwiftSoup.parse(htmlString) else { return nil }
guard
let htmlString = String(data: html, encoding: .utf8),
let document = try? SwiftSoup.parse(htmlString)
else { return nil }

let title = stringValue(.title, from: document)
let type = typeMetadata(from: document)
Expand Down
2 changes: 1 addition & 1 deletion Nos/Models/RawNostrID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public typealias RawEventID = RawNostrID
/// An alias for a RawNostrID that we know is for an Author. See docs for `RawNostrID`.
public typealias RawAuthorID = RawNostrID

extension RawNostrID: Identifiable {
extension RawNostrID {

public var id: String {
self
Expand Down
Loading

0 comments on commit 45b90a4

Please sign in to comment.