Translate `@optional`, `@required` Obj-C keywords in protocols

Description

Refer to ProtocolSample.swift.
Since the `required` keywords seem only supported by initializers, and the `optional` keyword is only supported by @objc methods:
http://take.ms/mbgly
... the initial suggestion is to declare "optional" methods as `@objc optional`, and "required" methods without any keywords, i.e.:

Objective:

Should translate to:

If easy, keep the blank line between optional and required groups (as above, except at the beginning or end of Swift protocol declarations).
The protocol declaration needs an `@objc` keyword if the protocol contains at least one `optional func` declaration that also needs an `@objc` keyword.
As always, you may use our website for testing: http://swi.run/olyqlq

Environment

None

Activity

Show:
Alex Bespalov
July 22, 2018, 11:50 PM
Edited

Currently converter adds blank lines between methods from the same group but doesn't between groups themselves.
I assume the latter one is a bug. Even if it's the case and we want to get output provided in sample we also will need to remove lines between methods, which looks like a more serious change.

Alex Petuschak
July 23, 2018, 2:15 PM

Currently, converter adds blank lines between methods from the same group but doesn't between groups themselves.
I assume the latter one is a bug

Let's add a blank line between groups for consistency.
Double check that this does not create double/excessive blank lines for other cases.

I've created to eliminate blank lines between methods declarations without a method body.

Assignee

Alex Bespalov

Reporter

Alex Petuschak

Labels

None

Git Branch Name

None

GitHub Issue

None

Components

Fix versions

Priority

High
Configure