lmirosevic / GBPing

Highly accurate ICMP Ping controller for iOS
Apache License 2.0
279 stars 87 forks source link

Nullability annotations #45

Closed robnadin closed 6 years ago

robnadin commented 6 years ago

This PR addresses the lack of nullability annotations when bridging to Swift. For example, object parameters in GBPingDelegate are currently imported into Swift as implicitly unwrapped optionals:

public protocol GBPingDelegate : NSObjectProtocol {
    optional public func ping(_ pinger: GBPing!, didFailWithError error: Error!)
    optional public func ping(_ pinger: GBPing!, didSendPingWith summary: GBPingSummary!)
    optional public func ping(_ pinger: GBPing!, didFailToSendPingWith summary: GBPingSummary!, error: Error!)
    optional public func ping(_ pinger: GBPing!, didTimeoutWith summary: GBPingSummary!)
    optional public func ping(_ pinger: GBPing!, didReceiveReplyWith summary: GBPingSummary!)
    optional public func ping(_ pinger: GBPing!, didReceiveUnexpectedReplyWith summary: GBPingSummary!)
}

With this PR, it will now be imported into Swift as:

public protocol GBPingDelegate : NSObjectProtocol {
    optional public func ping(_ pinger: GBPing, didFailWithError error: Error)
    optional public func ping(_ pinger: GBPing, didSendPingWith summary: GBPingSummary)
    optional public func ping(_ pinger: GBPing, didFailToSendPingWith summary: GBPingSummary, error: Error)
    optional public func ping(_ pinger: GBPing, didTimeoutWith summary: GBPingSummary)
    optional public func ping(_ pinger: GBPing, didReceiveReplyWith summary: GBPingSummary)
    optional public func ping(_ pinger: GBPing, didReceiveUnexpectedReplyWith summary: GBPingSummary)

There were also some warnings picked up by the static analyzer that have been resolved too.

lmirosevic commented 6 years ago

Thank you for this

lmirosevic commented 6 years ago

Published as 1.5.0