From 37f53566a6aade0aed1da3eff5f3af4017d2f64b Mon Sep 17 00:00:00 2001 From: Daniel Slone Date: Wed, 7 Jun 2023 23:58:05 +1000 Subject: [PATCH] updated variable naming --- README.md | 2 +- Sources/ReuseIdentifier/ReuseIdentifier.swift | 4 ++-- Sources/ReuseIdentifierClient/main.swift | 2 +- Sources/ReuseIdentifierMacros/ReuseIdentifierMacro.swift | 2 +- Tests/ReuseIdentifierTests/ReuseIdentifierTests.swift | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f51f8af..46922e8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,6 @@ class CarouselCollectionViewCell: UICollectionViewCell {} collectionView.register( CarouselCollectionViewCell.self, - forCellWithReuseIdentifier: CarouselCollectionViewCell.reuseID + forCellWithReuseIdentifier: CarouselCollectionViewCell.reuseIdentifier ) ``` diff --git a/Sources/ReuseIdentifier/ReuseIdentifier.swift b/Sources/ReuseIdentifier/ReuseIdentifier.swift index 3086c46..40dc146 100644 --- a/Sources/ReuseIdentifier/ReuseIdentifier.swift +++ b/Sources/ReuseIdentifier/ReuseIdentifier.swift @@ -4,8 +4,8 @@ /// @ReuseIdentifier /// class CarouselCollectionViewCell: UICollectionViewCell {} /// -/// CarouselCollectionViewCell.reuseID +/// CarouselCollectionViewCell.reuseIdentifier /// /// produces a static String,`CarouselCollectionViewCell` -@attached(member, names: named(reuseID)) +@attached(member, names: named(reuseIdentifier)) public macro ReuseIdentifier() = #externalMacro(module: "ReuseIdentifierMacros", type: "ReuseIdentifierMacro") diff --git a/Sources/ReuseIdentifierClient/main.swift b/Sources/ReuseIdentifierClient/main.swift index 72503a6..c381d47 100644 --- a/Sources/ReuseIdentifierClient/main.swift +++ b/Sources/ReuseIdentifierClient/main.swift @@ -3,4 +3,4 @@ import ReuseIdentifier @ReuseIdentifier class CarouselCollectionViewCell {} -let reuseID = CarouselCollectionViewCell.reuseID +let reuseID = CarouselCollectionViewCell.reuseIdentifier diff --git a/Sources/ReuseIdentifierMacros/ReuseIdentifierMacro.swift b/Sources/ReuseIdentifierMacros/ReuseIdentifierMacro.swift index ee7975c..a38c10c 100644 --- a/Sources/ReuseIdentifierMacros/ReuseIdentifierMacro.swift +++ b/Sources/ReuseIdentifierMacros/ReuseIdentifierMacro.swift @@ -23,7 +23,7 @@ public struct ReuseIdentifierMacro: MemberMacro { throw ReuseIdentifierError.onlyApplicableToClass } - let reuseID = try VariableDeclSyntax("static var reuseID: String") { + let reuseID = try VariableDeclSyntax("static var reuseIdentifier: String") { StringLiteralExprSyntax(content: classDecl.identifier.text) } diff --git a/Tests/ReuseIdentifierTests/ReuseIdentifierTests.swift b/Tests/ReuseIdentifierTests/ReuseIdentifierTests.swift index a5f01e6..d9603e3 100644 --- a/Tests/ReuseIdentifierTests/ReuseIdentifierTests.swift +++ b/Tests/ReuseIdentifierTests/ReuseIdentifierTests.swift @@ -18,7 +18,7 @@ final class ReuseIdentifierTests: XCTestCase { expandedSource: """ class CarouselCollectionViewCell { - static var reuseID: String { + static var reuseIdentifier: String { "CarouselCollectionViewCell" } }