raven-objc icon indicating copy to clipboard operation
raven-objc copied to clipboard

Increase Swift support

Open fizker opened this issue 10 years ago • 5 comments

I added nullability annotations and generic types for the dictionaries. This makes the compiler help you regardless of language, and makes the project much more usable from Swift.

I made some guesses on null and the <NSString *, NSString *> dictionaries based on the code and the tests, so there is a chance that the annotations are wrong ;).

The one downside is that it requires Xcode 7 to understand the annotations.

fizker avatar Nov 29 '15 10:11 fizker

@fizker I think this is sane

For context on the dictionaries, and please confirm that this is correct in the code, both tags and extra can be null. tags should be a list of map[string][string] and extra should effectively be map[string][any].

dcramer avatar Nov 30 '15 21:11 dcramer

Are you sure about extra and tags being nullable?

  1. The convenience constructors at https://github.com/getsentry/raven-objc/blob/master/Raven/RavenClient.m#L115-L121 pass in @{} instead of nil

  2. At https://github.com/getsentry/raven-objc/blob/master/Raven/RavenClient.m#L365 and https://github.com/getsentry/raven-objc/blob/master/Raven/RavenClient.m#L370, they are used as parameters to [NSMutableDictionary dictionaryWithDictionary:], which is marked as being nonnull by Apple.

    It does not seem to hurt passing nil to [NSMutableDictionary dictionaryWithDictionary:], but the docs does say that it should not be nil.

I will change the extra type to be NSDictionary<NSString*,NSObject*>.

fizker avatar Dec 01 '15 14:12 fizker

I'm at least certain that the server endpoint accepts this as nullable or empty.

dcramer avatar Dec 03 '15 01:12 dcramer

I am fine with the server being more lax than the client. I would actually prefer the dictionaries to be non-nil, as it makes the client API easier to work with. I see the nil (or missing) property for the web to be a bandwidth issue more than anything else.

fizker avatar Dec 08 '15 12:12 fizker

Is there anything I can do to help this along?

fizker avatar Feb 24 '16 19:02 fizker