Reputation: 10422
I am building an open source component for shaking a UIView, and for accessibility I want the method call to be able to be called with an extra method specifying an accessibility text that should be read to VoiceOver
My current API is
button.shake(.Horizontal)
I want it to be able to be called with a way of posting an accessabilitynotification as well, and since there allready are so many optional arguments in the shake method signature, I was thinking chaining the method call would be nice.
So my idea is to
button.shake(.Horizontal).postAccessabilityNotification(text: "Your attention is required on \(button.accessabilityLabel)")
Method signature would be
public func postAccessabilityNotification(#text : String ) {
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, text)
}
Is it possible to chain the method call? Would be nice to post a default notification on shake() if the postAccessabilityNotification was not chained.
Here's the GitHub page: https://github.com/haaakon/SingleLineShakeAnimation
Upvotes: 1
Views: 1589