Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

UIKeyboard.Notifications members are unpleasant to use from F# #1

Open
dvdsgl opened this issue Jun 19, 2014 · 0 comments
Open

UIKeyboard.Notifications members are unpleasant to use from F# #1

dvdsgl opened this issue Jun 19, 2014 · 0 comments

Comments

@dvdsgl
Copy link
Owner

dvdsgl commented Jun 19, 2014

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.

@dvdsgl dvdsgl changed the title UIKit.Notifications members are unpleasant to use from F# UIKeyboard.Notifications members are unpleasant to use from F# Jun 19, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant