raven-objc
raven-objc copied to clipboard
Increase Swift support
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 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].
Are you sure about extra and tags being nullable?
-
The convenience constructors at https://github.com/getsentry/raven-objc/blob/master/Raven/RavenClient.m#L115-L121 pass in
@{}instead ofnil -
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 beingnonnullby Apple.It does not seem to hurt passing
nilto[NSMutableDictionary dictionaryWithDictionary:], but the docs does say that it should not benil.
I will change the extra type to be NSDictionary<NSString*,NSObject*>.
I'm at least certain that the server endpoint accepts this as nullable or empty.
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.
Is there anything I can do to help this along?