Skip to content

Instantly share code, notes, and snippets.

@LucianoPAlmeida
Created April 15, 2019 02:51
Show Gist options
  • Save LucianoPAlmeida/0993a40af8ebe19e2285a1a9eba73d70 to your computer and use it in GitHub Desktop.
Save LucianoPAlmeida/0993a40af8ebe19e2285a1a9eba73d70 to your computer and use it in GitHub Desktop.
SyntaxVisitor
import SwiftSyntax
class FindPublicExtensionDeclVisitor: SyntaxVisitor {
override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind {
if node.modifiers?.contains(where: { $0.name.tokenKind == .publicKeyword }) == true {
// Do something if you find a `public extension` declaration.
}
return SyntaxVisitorContinueKind.skipChildren
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment