You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the most part, Swiftify has been good about preserving the line breaks as I had them in my code. By comparison, this was a big problem I had with the Kotlin converter in Android Studio, which was eager to remove empty lines that I used to organize and separate blocks of code. But Swiftify has still done this in some cases:
If I have many elements in a conditional, it is sometimes nice to break them into separate lines for readability. For example:
Some classes have dozens of properties, and I use empty lines to group related properties. These lines were preserved for most of my project, but did a recent converter update change this? The last few files I converted had these empty lines stripped out. Hopefully this was not a side effect of issue 153. For example:
var boxSize = CGSize.zero
var boxPosition = CGPoint.zero
var boxColor: UIColor?
var lineSize = CGSize.zero
var linePosition = CGPoint.zero
var lineColor: UIColor?
@arlomedia Thanks for the suggestions!
Keeping original style is way more difficult than just reformatting the output, but we are getting there.
I'll split this into a few issues, but this may take a while to be implemented.
For the most part, Swiftify has been good about preserving the line breaks as I had them in my code. By comparison, this was a big problem I had with the Kotlin converter in Android Studio, which was eager to remove empty lines that I used to organize and separate blocks of code. But Swiftify has still done this in some cases:
If I have many elements in a conditional, it is sometimes nice to break them into separate lines for readability. For example:
if (
(itemName == “documentButton”)
||
(itemName == “recordingButton”)
||
(itemName == “midiButton”)
(etc)
) {
[self doSomething];
}
This is changed to:
Converter example: http://swiftify.me/23yd31/1
Conversely, I sometimes have a series of very short conditionals that I like to put on one line. For example:
if (width < min_width) { width = min_width }
if (width < max_width) { width = max_width }
if (height < min_height) { height = min_height }
if (height > max_height) { height = max_height }
(Yes, that could use max and min functions; this is just an example.) This is changed to:
Converter example: http://swiftify.me/mvecpr/2
Some classes have dozens of properties, and I use empty lines to group related properties. These lines were preserved for most of my project, but did a recent converter update change this? The last few files I converted had these empty lines stripped out. Hopefully this was not a side effect of issue 153. For example:
@Property (nonatomic) CGSize boxSize;
@Property (nonatomic) CGPoint boxPosition;
@Property (nonatomic, strong) UIColor *boxColor;
@Property (nonatomic) CGSize lineSize;
@Property (nonatomic) CGPoint linePosition;
@Property (nonatomic, strong) UIColor *lineColor;
This is changed to:
Converter example: http://swiftify.me/zyu8zi
The text was updated successfully, but these errors were encountered: