Cannot pass nil to two additional parameters
I am reworking an Objective-C category into a Swift extension to provide simplified methods for adding constraints. One method for even-spaced presentation has the following signature:
func addAndEquallySpaceViews(views: [UIView], leftOrTopSpace: CGFloat?, rightOrBottomSpace: CGFloat?, options: NSLayoutFormatOptions?)
I call it like this:
self.view.addAndEquallySpaceViews([view1, view2], leftOrTopSpace: nil, rightOrBottomSpace: nil, options: .AlignAllBottom)
I want to be able to pass nil in the leftOrTopSpace and rightOrBottomSpace parameters, but when I pass nil for both of them, I get a series of compile time errors. I can pass zero to either of them, but not both. Why can't I pass nil for both optional parameters?
The errors I get seem to be non-specific and not related to the relevant line,
+3
source to share