-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from JosephDuffy/nsobject-improvements
NSObject API Improvements
- Loading branch information
Showing
20 changed files
with
1,218 additions
and
1,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Sources/HashableMacro/IsEqualToTypeFunctionNameGeneration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if canImport(HashableMacroFoundation) | ||
#if canImport(ObjectiveC) | ||
import HashableMacroFoundation | ||
|
||
public typealias IsEqualToTypeFunctionNameGeneration = HashableMacroFoundation.IsEqualToTypeFunctionNameGeneration | ||
#else | ||
#warning("ObjectiveC should be importable when HashableMacroFoundation can be imported") | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Sources/HashableMacroFoundation/IsEqualToTypeFunctionNameGeneration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#if canImport(ObjectiveC) | ||
/// How to generate the name of the Objective-C function used to compare 2 | ||
/// instances of the same type. | ||
public enum IsEqualToTypeFunctionNameGeneration: Sendable { | ||
/// Use an automatically generated name for the Objective-C function, e.g. | ||
/// for a class named `Person` this would use `isEqualToPerson:`. | ||
case automatic | ||
|
||
/// Use the provided name for the Objective-C function. | ||
/// | ||
/// - parameter objectiveCName: The name of the function when used from | ||
/// Objective-C. This should include a trailing colon. | ||
case custom(_ objectiveCName: String) | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Sources/HashableMacroMacros/Diagnostics/HashableMacroDiagnosticMessage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#if canImport(SwiftSyntax510) | ||
import SwiftDiagnostics | ||
#else | ||
@preconcurrency import SwiftDiagnostics | ||
#endif | ||
|
||
struct HashableMacroDiagnosticMessage: DiagnosticMessage, Error { | ||
let message: String | ||
let diagnosticID: MessageID | ||
let severity: DiagnosticSeverity | ||
|
||
init(id: String, message: String, severity: DiagnosticSeverity) { | ||
self.message = message | ||
diagnosticID = MessageID.makeHashableMacroMessageID(id: id) | ||
self.severity = severity | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Sources/HashableMacroMacros/Diagnostics/HashableMacroFixItMessage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import SwiftDiagnostics | ||
|
||
struct HashableMacroFixItMessage: FixItMessage { | ||
let fixItID: MessageID | ||
let message: String | ||
|
||
init(id: String, message: String) { | ||
fixItID = MessageID.makeHashableMacroMessageID(id: id) | ||
self.message = message | ||
} | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
Sources/HashableMacroMacros/Diagnostics/MessageID+HashableMacro.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import SwiftDiagnostics | ||
|
||
extension MessageID { | ||
static func makeHashableMacroMessageID(id: String) -> MessageID { | ||
MessageID(domain: "uk.josephduffy.HashableMacro", id: id) | ||
} | ||
} |
Oops, something went wrong.