Fix nil issue with several Array and Dictionary methods #247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Several foundation methods take a list of objects and expect a nil to be used to terminate the list. Problem is the nil these methods want is an Objective-c nil. Using Go's nil causes a crash to take place.
This pull request fixes the issue with several nil terminated methods. The way I fixed the issue was by introducing a new system that uses a file called special.go to override and prevent the generation of specified methods.
A new folder called special will be in the "generated" folder of DarwinKit. In this folder will be a platform folder. Currently we have a macOS folder. Inside the platform folder is a framework folder. This currently has a foundation folder. Inside this folder is a file called special.go. This file will contain the definition for methods that we don't want the generation system to make. To tell the generation system not to try to generate any method, the special.go file will contain a table. This table has this format:
It is all located inside a comment. It begins with the text "begin-skip" on its own line, and ends with the text "end-skip" on its own line. Between these lines will be three fields that are separated by commas and each is wrapped with double quotes. The fields will be an objective-c class name, a selector, and a note.
Example: "NSMutableDictionary", "initWithObjectsAndKeys:", "using custom implementation"
With this pull request methods like MutableDictionary's InitWithObjectsAndKeys() will actually work. Go's nil can be used to terminate the list or it can be omitted.