shallow
shallow copied to clipboard
UIKeyboard.Notifications members are unpleasant to use from F#
For example, to handle UIKeyboard.WillShowNotification
, I have to call UIKeyboard.Notifications.ObserveWillShow
, and manually wrap a function in an EventHandler
:
UIKeyboard.Notifications.ObserveWillShow(EventHandler<_>(fun sender args ->
doSomething args))
When I would expect to be able to just do this:
UIKeyboard.WillShow.Add(doSomething)
To allow this, I added a static event to UIKeyboard
:
module UIKeyboardNotifications =
let WillShow = Event<_>()
UIKeyboard.Notifications.ObserveWillShow(EventHandler<_>(fun sender args -> WillShow.Trigger(args)))
type UIKeyboard with
static member WillShow = UIKeyboardNotifications.WillShow.Publish
But this should be part of MonoTouch.dll
.