I know there are limited ways to create own custom Annotations in Java. One article describes here a way. I wonder, is it possible to create custom Annotation
in Swift
as well? For example, I have a BaseViewController
and I want to test if any of its subclass created added annotation to log function names or not.
class BaseViewController: ViewController {
func viewWillAppear() {
// want to get if annotation added from caller and use
super.viewWillAppear()
}
}
class SubViewController: BaseViewController {
@LogEntrance // custom annotation
func viewWillAppear() {
super.viewWillAppear()
}
}
If there is no way to use like it, How can I controller it otherwise? any workaround?
Context - I would be needing this for my large scale Swift
app. I am using logger but I want to give developers flexibility to log classes, functions entrance and exits. Currently developers are putting logs at the entrance and exits of their functions and I want to give them annotation if possible.