From 97fd00e400692b04082a897076865f48bde8927d Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Sun, 22 Oct 2017 13:54:06 +0200 Subject: [PATCH 1/8] Add accessModifier param to templates --- ...s-swift3-context-defaults-customname.swift | 4 +- .../literals-swift3-context-defaults.swift | 6 +- .../literals-swift3-context-multiple.swift | 6 +- ...s-swift4-context-defaults-customname.swift | 4 +- .../literals-swift4-context-defaults.swift | 6 +- .../literals-swift4-context-multiple.swift | 6 +- .../swift2-context-defaults-customname.swift | 22 ++--- .../Colors/swift2-context-defaults.swift | 22 ++--- .../Colors/swift2-context-multiple.swift | 40 ++++----- .../swift3-context-defaults-customname.swift | 22 ++--- .../Colors/swift3-context-defaults.swift | 22 ++--- .../Colors/swift3-context-multiple.swift | 40 ++++----- .../swift4-context-defaults-customname.swift | 22 ++--- .../Colors/swift4-context-defaults.swift | 22 ++--- .../Colors/swift4-context-multiple.swift | 40 ++++----- .../swift2-context-defaults-customname.swift | 72 ++++++++-------- ...swift2-context-defaults-preservepath.swift | 72 ++++++++-------- .../Fonts/swift2-context-defaults.swift | 72 ++++++++-------- .../swift3-context-defaults-customname.swift | 72 ++++++++-------- ...swift3-context-defaults-preservepath.swift | 72 ++++++++-------- .../Fonts/swift3-context-defaults.swift | 72 ++++++++-------- .../swift4-context-defaults-customname.swift | 72 ++++++++-------- ...swift4-context-defaults-preservepath.swift | 72 ++++++++-------- .../Fonts/swift4-context-defaults.swift | 72 ++++++++-------- .../swift2-context-all-customname.swift | 86 +++++++++---------- ...ignore-module-need-extra-definitions.swift | 86 +++++++++---------- .../swift2-context-all-ignore-module.swift | 86 +++++++++---------- .../Storyboards-iOS/swift2-context-all.swift | 86 +++++++++---------- .../swift3-context-all-customname.swift | 86 +++++++++---------- ...ignore-module-need-extra-definitions.swift | 86 +++++++++---------- .../swift3-context-all-ignore-module.swift | 86 +++++++++---------- .../Storyboards-iOS/swift3-context-all.swift | 86 +++++++++---------- .../swift4-context-all-customname.swift | 86 +++++++++---------- ...ignore-module-need-extra-definitions.swift | 86 +++++++++---------- .../swift4-context-all-ignore-module.swift | 86 +++++++++---------- .../Storyboards-iOS/swift4-context-all.swift | 86 +++++++++---------- .../swift2-context-all-customname.swift | 68 +++++++-------- ...ignore-module-need-extra-definitions.swift | 68 +++++++-------- .../swift2-context-all-ignore-module.swift | 68 +++++++-------- .../swift2-context-all.swift | 68 +++++++-------- .../swift3-context-all-customname.swift | 68 +++++++-------- ...ignore-module-need-extra-definitions.swift | 68 +++++++-------- .../swift3-context-all-ignore-module.swift | 68 +++++++-------- .../swift3-context-all.swift | 68 +++++++-------- .../swift4-context-all-customname.swift | 68 +++++++-------- ...ignore-module-need-extra-definitions.swift | 68 +++++++-------- .../swift4-context-all-ignore-module.swift | 68 +++++++-------- .../swift4-context-all.swift | 68 +++++++-------- ...wift2-context-localizable-customname.swift | 24 +++--- ...ift2-context-localizable-no-comments.swift | 24 +++--- .../flat-swift2-context-localizable.swift | 24 +++--- .../flat-swift2-context-multiple.swift | 38 ++++---- ...wift3-context-localizable-customname.swift | 24 +++--- ...ift3-context-localizable-no-comments.swift | 24 +++--- .../flat-swift3-context-localizable.swift | 24 +++--- .../flat-swift3-context-multiple.swift | 38 ++++---- ...wift4-context-localizable-customname.swift | 24 +++--- ...ift4-context-localizable-no-comments.swift | 24 +++--- .../flat-swift4-context-localizable.swift | 24 +++--- .../flat-swift4-context-multiple.swift | 38 ++++---- ...wift2-context-localizable-customname.swift | 56 ++++++------ ...ift2-context-localizable-no-comments.swift | 56 ++++++------ ...tructured-swift2-context-localizable.swift | 56 ++++++------ .../structured-swift2-context-multiple.swift | 70 +++++++-------- ...wift3-context-localizable-customname.swift | 56 ++++++------ ...ift3-context-localizable-no-comments.swift | 56 ++++++------ ...tructured-swift3-context-localizable.swift | 56 ++++++------ .../structured-swift3-context-multiple.swift | 70 +++++++-------- ...wift4-context-localizable-customname.swift | 56 ++++++------ ...ift4-context-localizable-no-comments.swift | 56 ++++++------ ...tructured-swift4-context-localizable.swift | 56 ++++++------ .../structured-swift4-context-multiple.swift | 70 +++++++-------- .../swift2-context-all-customname.swift | 72 ++++++++-------- .../swift2-context-all-no-all-values.swift | 60 ++++++------- .../XCAssets/swift2-context-all.swift | 72 ++++++++-------- .../swift3-context-all-customname.swift | 80 ++++++++--------- .../swift3-context-all-no-all-values.swift | 68 +++++++-------- .../XCAssets/swift3-context-all.swift | 80 ++++++++--------- .../swift4-context-all-customname.swift | 80 ++++++++--------- .../swift4-context-all-no-all-values.swift | 68 +++++++-------- .../XCAssets/swift4-context-all.swift | 80 ++++++++--------- templates/colors/literals-swift3.stencil | 7 +- templates/colors/literals-swift4.stencil | 7 +- templates/colors/swift2.stencil | 19 ++-- templates/colors/swift3.stencil | 19 ++-- templates/colors/swift4.stencil | 19 ++-- templates/fonts/swift2.stencil | 25 +++--- templates/fonts/swift3.stencil | 25 +++--- templates/fonts/swift4.stencil | 25 +++--- templates/storyboards/swift2.stencil | 37 ++++---- templates/storyboards/swift3.stencil | 37 ++++---- templates/storyboards/swift4.stencil | 37 ++++---- templates/strings/flat-swift2.stencil | 9 +- templates/strings/flat-swift3.stencil | 9 +- templates/strings/flat-swift4.stencil | 9 +- templates/strings/structured-swift2.stencil | 11 +-- templates/strings/structured-swift3.stencil | 11 +-- templates/strings/structured-swift4.stencil | 11 +-- templates/xcassets/swift2.stencil | 35 ++++---- templates/xcassets/swift3.stencil | 43 +++++----- templates/xcassets/swift4.stencil | 43 +++++----- 101 files changed, 2471 insertions(+), 2451 deletions(-) diff --git a/Tests/Expected/Colors/literals-swift3-context-defaults-customname.swift b/Tests/Expected/Colors/literals-swift3-context-defaults-customname.swift index f04db3d..32213dc 100644 --- a/Tests/Expected/Colors/literals-swift3-context-defaults-customname.swift +++ b/Tests/Expected/Colors/literals-swift3-context-defaults-customname.swift @@ -2,7 +2,7 @@ #if os(OSX) import AppKit - enum UIColor { } + internal enum UIColor { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit #endif @@ -11,7 +11,7 @@ // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension UIColor { +internal extension UIColor { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) diff --git a/Tests/Expected/Colors/literals-swift3-context-defaults.swift b/Tests/Expected/Colors/literals-swift3-context-defaults.swift index 8ef90da..5851e07 100644 --- a/Tests/Expected/Colors/literals-swift3-context-defaults.swift +++ b/Tests/Expected/Colors/literals-swift3-context-defaults.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit - enum ColorName { } + internal enum ColorName { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - enum ColorName { } + internal enum ColorName { } #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension ColorName { +internal extension ColorName { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) diff --git a/Tests/Expected/Colors/literals-swift3-context-multiple.swift b/Tests/Expected/Colors/literals-swift3-context-multiple.swift index 40f4ab5..8a4999d 100644 --- a/Tests/Expected/Colors/literals-swift3-context-multiple.swift +++ b/Tests/Expected/Colors/literals-swift3-context-multiple.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit - enum ColorName { } + internal enum ColorName { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - enum ColorName { } + internal enum ColorName { } #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension ColorName { +internal extension ColorName { enum Colors { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) diff --git a/Tests/Expected/Colors/literals-swift4-context-defaults-customname.swift b/Tests/Expected/Colors/literals-swift4-context-defaults-customname.swift index f04db3d..32213dc 100644 --- a/Tests/Expected/Colors/literals-swift4-context-defaults-customname.swift +++ b/Tests/Expected/Colors/literals-swift4-context-defaults-customname.swift @@ -2,7 +2,7 @@ #if os(OSX) import AppKit - enum UIColor { } + internal enum UIColor { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit #endif @@ -11,7 +11,7 @@ // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension UIColor { +internal extension UIColor { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) diff --git a/Tests/Expected/Colors/literals-swift4-context-defaults.swift b/Tests/Expected/Colors/literals-swift4-context-defaults.swift index 8ef90da..5851e07 100644 --- a/Tests/Expected/Colors/literals-swift4-context-defaults.swift +++ b/Tests/Expected/Colors/literals-swift4-context-defaults.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit - enum ColorName { } + internal enum ColorName { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - enum ColorName { } + internal enum ColorName { } #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension ColorName { +internal extension ColorName { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) diff --git a/Tests/Expected/Colors/literals-swift4-context-multiple.swift b/Tests/Expected/Colors/literals-swift4-context-multiple.swift index 40f4ab5..8a4999d 100644 --- a/Tests/Expected/Colors/literals-swift4-context-multiple.swift +++ b/Tests/Expected/Colors/literals-swift4-context-multiple.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit - enum ColorName { } + internal enum ColorName { } #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - enum ColorName { } + internal enum ColorName { } #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension ColorName { +internal extension ColorName { enum Colors { /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) diff --git a/Tests/Expected/Colors/swift2-context-defaults-customname.swift b/Tests/Expected/Colors/swift2-context-defaults-customname.swift index 7dfc83f..1fde478 100644 --- a/Tests/Expected/Colors/swift2-context-defaults-customname.swift +++ b/Tests/Expected/Colors/swift2-context-defaults-customname.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias XCTColor = NSColor + internal typealias XCTColor = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias XCTColor = UIColor + internal typealias XCTColor = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension XCTColor { +internal extension XCTColor { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension XCTColor { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct XCTColors { - let rgbaValue: UInt32 - var color: XCTColor { return XCTColor(named: self) } +internal struct XCTColors { + internal let rgbaValue: UInt32 + internal var color: XCTColor { return XCTColor(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let ArticleBody = XCTColors(rgbaValue: 0x339666ff) + internal static let ArticleBody = XCTColors(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let ArticleFootnote = XCTColors(rgbaValue: 0xff66ccff) + internal static let ArticleFootnote = XCTColors(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let ArticleTitle = XCTColors(rgbaValue: 0x33fe66ff) + internal static let ArticleTitle = XCTColors(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let Private = XCTColors(rgbaValue: 0xffffffcc) + internal static let Private = XCTColors(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension XCTColor { +internal extension XCTColor { convenience init(named color: XCTColors) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift2-context-defaults.swift b/Tests/Expected/Colors/swift2-context-defaults.swift index 5571db3..c6e1939 100644 --- a/Tests/Expected/Colors/swift2-context-defaults.swift +++ b/Tests/Expected/Colors/swift2-context-defaults.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let ArticleBody = ColorName(rgbaValue: 0x339666ff) + internal static let ArticleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let Private = ColorName(rgbaValue: 0xffffffcc) + internal static let Private = ColorName(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift2-context-multiple.swift b/Tests/Expected/Colors/swift2-context-multiple.swift index cc006da..faa20d0 100644 --- a/Tests/Expected/Colors/swift2-context-multiple.swift +++ b/Tests/Expected/Colors/swift2-context-multiple.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,51 +25,51 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } - enum Colors { + internal enum Colors { /// /// Alpha: 100%
(0x339666ff) - static let ArticleBody = ColorName(rgbaValue: 0x339666ff) + internal static let ArticleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let Private = ColorName(rgbaValue: 0xffffffcc) + internal static let Private = ColorName(rgbaValue: 0xffffffcc) } - enum Extra { + internal enum Extra { /// /// Alpha: 100%
(0x339666ff) - static let ArticleBody = ColorName(rgbaValue: 0x339666ff) + internal static let ArticleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 100%
(0xff66ccff) - static let CyanColor = ColorName(rgbaValue: 0xff66ccff) + internal static let CyanColor = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 80%
(0xffffffcc) - static let NamedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let NamedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let NestedNamedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let NestedNamedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let Private = ColorName(rgbaValue: 0xffffffcc) + internal static let Private = ColorName(rgbaValue: 0xffffffcc) } } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift3-context-defaults-customname.swift b/Tests/Expected/Colors/swift3-context-defaults-customname.swift index 3495a4f..d2dd917 100644 --- a/Tests/Expected/Colors/swift3-context-defaults-customname.swift +++ b/Tests/Expected/Colors/swift3-context-defaults-customname.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias XCTColor = NSColor + internal typealias XCTColor = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias XCTColor = UIColor + internal typealias XCTColor = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension XCTColor { +internal extension XCTColor { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension XCTColor { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct XCTColors { - let rgbaValue: UInt32 - var color: XCTColor { return XCTColor(named: self) } +internal struct XCTColors { + internal let rgbaValue: UInt32 + internal var color: XCTColor { return XCTColor(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let articleBody = XCTColors(rgbaValue: 0x339666ff) + internal static let articleBody = XCTColors(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = XCTColors(rgbaValue: 0xff66ccff) + internal static let articleFootnote = XCTColors(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = XCTColors(rgbaValue: 0x33fe66ff) + internal static let articleTitle = XCTColors(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = XCTColors(rgbaValue: 0xffffffcc) + internal static let `private` = XCTColors(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension XCTColor { +internal extension XCTColor { convenience init(named color: XCTColors) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift3-context-defaults.swift b/Tests/Expected/Colors/swift3-context-defaults.swift index 62a5012..1ba4223 100644 --- a/Tests/Expected/Colors/swift3-context-defaults.swift +++ b/Tests/Expected/Colors/swift3-context-defaults.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift3-context-multiple.swift b/Tests/Expected/Colors/swift3-context-multiple.swift index 4c955bc..b576090 100644 --- a/Tests/Expected/Colors/swift3-context-multiple.swift +++ b/Tests/Expected/Colors/swift3-context-multiple.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,51 +25,51 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } - enum Colors { + internal enum Colors { /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } - enum Extra { + internal enum Extra { /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 100%
(0xff66ccff) - static let cyanColor = ColorName(rgbaValue: 0xff66ccff) + internal static let cyanColor = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 80%
(0xffffffcc) - static let namedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let namedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let nestedNamedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let nestedNamedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift4-context-defaults-customname.swift b/Tests/Expected/Colors/swift4-context-defaults-customname.swift index 3495a4f..d2dd917 100644 --- a/Tests/Expected/Colors/swift4-context-defaults-customname.swift +++ b/Tests/Expected/Colors/swift4-context-defaults-customname.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias XCTColor = NSColor + internal typealias XCTColor = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias XCTColor = UIColor + internal typealias XCTColor = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension XCTColor { +internal extension XCTColor { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension XCTColor { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct XCTColors { - let rgbaValue: UInt32 - var color: XCTColor { return XCTColor(named: self) } +internal struct XCTColors { + internal let rgbaValue: UInt32 + internal var color: XCTColor { return XCTColor(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let articleBody = XCTColors(rgbaValue: 0x339666ff) + internal static let articleBody = XCTColors(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = XCTColors(rgbaValue: 0xff66ccff) + internal static let articleFootnote = XCTColors(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = XCTColors(rgbaValue: 0x33fe66ff) + internal static let articleTitle = XCTColors(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = XCTColors(rgbaValue: 0xffffffcc) + internal static let `private` = XCTColors(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension XCTColor { +internal extension XCTColor { convenience init(named color: XCTColors) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift4-context-defaults.swift b/Tests/Expected/Colors/swift4-context-defaults.swift index 62a5012..1ba4223 100644 --- a/Tests/Expected/Colors/swift4-context-defaults.swift +++ b/Tests/Expected/Colors/swift4-context-defaults.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,26 +25,26 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Colors/swift4-context-multiple.swift b/Tests/Expected/Colors/swift4-context-multiple.swift index 4c955bc..b576090 100644 --- a/Tests/Expected/Colors/swift4-context-multiple.swift +++ b/Tests/Expected/Colors/swift4-context-multiple.swift @@ -2,17 +2,17 @@ #if os(OSX) import AppKit.NSColor - typealias Color = NSColor + internal typealias Color = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias Color = UIColor + internal typealias Color = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension Color { +internal extension Color { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -25,51 +25,51 @@ extension Color { // swiftlint:enable operator_usage_whitespace // swiftlint:disable identifier_name line_length type_body_length -struct ColorName { - let rgbaValue: UInt32 - var color: Color { return Color(named: self) } +internal struct ColorName { + internal let rgbaValue: UInt32 + internal var color: Color { return Color(named: self) } - enum Colors { + internal enum Colors { /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } - enum Extra { + internal enum Extra { /// /// Alpha: 100%
(0x339666ff) - static let articleBody = ColorName(rgbaValue: 0x339666ff) + internal static let articleBody = ColorName(rgbaValue: 0x339666ff) /// /// Alpha: 100%
(0xff66ccff) - static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + internal static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 100%
(0x33fe66ff) - static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + internal static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) /// /// Alpha: 100%
(0xff66ccff) - static let cyanColor = ColorName(rgbaValue: 0xff66ccff) + internal static let cyanColor = ColorName(rgbaValue: 0xff66ccff) /// /// Alpha: 80%
(0xffffffcc) - static let namedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let namedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let nestedNamedValue = ColorName(rgbaValue: 0xffffffcc) + internal static let nestedNamedValue = ColorName(rgbaValue: 0xffffffcc) /// /// Alpha: 80%
(0xffffffcc) - static let `private` = ColorName(rgbaValue: 0xffffffcc) + internal static let `private` = ColorName(rgbaValue: 0xffffffcc) } } // swiftlint:enable identifier_name line_length type_body_length -extension Color { +internal extension Color { convenience init(named color: ColorName) { self.init(rgbaValue: color.rgbaValue) } diff --git a/Tests/Expected/Fonts/swift2-context-defaults-customname.swift b/Tests/Expected/Fonts/swift2-context-defaults-customname.swift index b5a5f47..81e76f9 100644 --- a/Tests/Expected/Fonts/swift2-context-defaults-customname.swift +++ b/Tests/Expected/Fonts/swift2-context-defaults-customname.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .Process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNamesForFamilyName(font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum CustomFamily { - enum SFNSDisplay { - static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum CustomFamily { + internal enum SFNSDisplay { + internal static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let Internal = FontConvertible("private", family: "public", path: "class.ttf") + internal enum Public { + internal static let Internal = FontConvertible("private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift2-context-defaults-preservepath.swift b/Tests/Expected/Fonts/swift2-context-defaults-preservepath.swift index 0cdc381..7b38acc 100644 --- a/Tests/Expected/Fonts/swift2-context-defaults-preservepath.swift +++ b/Tests/Expected/Fonts/swift2-context-defaults-preservepath.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .Process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNamesForFamilyName(font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") - static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") - static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") - static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") + internal static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") } - enum SFNSText { - static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") - static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") - static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") + internal enum SFNSText { + internal static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") } - enum Avenir { - static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") - static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") - static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") - static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") - static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") - static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") + internal enum Avenir { + internal static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") } - enum ZapfDingbats { - static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") } - enum Public { - static let Internal = FontConvertible("private", family: "public", path: "Fonts/class.ttf") + internal enum Public { + internal static let Internal = FontConvertible("private", family: "public", path: "Fonts/class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift2-context-defaults.swift b/Tests/Expected/Fonts/swift2-context-defaults.swift index d3a4f54..31416e0 100644 --- a/Tests/Expected/Fonts/swift2-context-defaults.swift +++ b/Tests/Expected/Fonts/swift2-context-defaults.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .Process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNamesForFamilyName(font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let Internal = FontConvertible("private", family: "public", path: "class.ttf") + internal enum Public { + internal static let Internal = FontConvertible("private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift3-context-defaults-customname.swift b/Tests/Expected/Fonts/swift3-context-defaults-customname.swift index 79dc084..fe2ca23 100644 --- a/Tests/Expected/Fonts/swift3-context-defaults-customname.swift +++ b/Tests/Expected/Fonts/swift3-context-defaults-customname.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum CustomFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum CustomFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift3-context-defaults-preservepath.swift b/Tests/Expected/Fonts/swift3-context-defaults-preservepath.swift index 4a8b7b0..1febcbc 100644 --- a/Tests/Expected/Fonts/swift3-context-defaults-preservepath.swift +++ b/Tests/Expected/Fonts/swift3-context-defaults-preservepath.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "Fonts/class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "Fonts/class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift3-context-defaults.swift b/Tests/Expected/Fonts/swift3-context-defaults.swift index b479b5f..39b82c0 100644 --- a/Tests/Expected/Fonts/swift3-context-defaults.swift +++ b/Tests/Expected/Fonts/swift3-context-defaults.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift4-context-defaults-customname.swift b/Tests/Expected/Fonts/swift4-context-defaults-customname.swift index 79dc084..fe2ca23 100644 --- a/Tests/Expected/Fonts/swift4-context-defaults-customname.swift +++ b/Tests/Expected/Fonts/swift4-context-defaults-customname.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum CustomFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum CustomFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift4-context-defaults-preservepath.swift b/Tests/Expected/Fonts/swift4-context-defaults-preservepath.swift index 4a8b7b0..1febcbc 100644 --- a/Tests/Expected/Fonts/swift4-context-defaults-preservepath.swift +++ b/Tests/Expected/Fonts/swift4-context-defaults-preservepath.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "Fonts/SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "Fonts/SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "Fonts/SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "Fonts/SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Fonts/Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Fonts/Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "Fonts/ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "Fonts/class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "Fonts/class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Fonts/swift4-context-defaults.swift b/Tests/Expected/Fonts/swift4-context-defaults.swift index b479b5f..39b82c0 100644 --- a/Tests/Expected/Fonts/swift4-context-defaults.swift +++ b/Tests/Expected/Fonts/swift4-context-defaults.swift @@ -2,25 +2,25 @@ #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + internal typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + internal typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +internal struct FontConvertible { + internal let name: String + internal let family: String + internal let path: String - func font(size: CGFloat) -> Font! { + internal func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + internal func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -32,7 +32,7 @@ struct FontConvertible { } } -extension Font { +internal extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -49,37 +49,37 @@ extension Font { } // swiftlint:disable identifier_name line_length type_body_length -enum FontFamily { - enum SFNSDisplay { - static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") - static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") +internal enum FontFamily { + internal enum SFNSDisplay { + internal static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + internal static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") } - enum SFNSText { - static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") - static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") - static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + internal enum SFNSText { + internal static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + internal static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + internal static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") } - enum Avenir { - static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") - static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") - static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") - static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") - static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") - static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") - static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") - static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") - static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") - static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") - static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") - static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + internal enum Avenir { + internal static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + internal static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + internal static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + internal static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + internal static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + internal static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + internal static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + internal static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + internal static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + internal static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + internal static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + internal static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") } - enum ZapfDingbats { - static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + internal enum ZapfDingbats { + internal static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") } - enum Public { - static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + internal enum Public { + internal static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Storyboards-iOS/swift2-context-all-customname.swift b/Tests/Expected/Storyboards-iOS/swift2-context-all-customname.swift index 52e28df..33bb463 100644 --- a/Tests/Expected/Storyboards-iOS/swift2-context-all-customname.swift +++ b/Tests/Expected/Storyboards-iOS/swift2-context-all-customname.swift @@ -10,21 +10,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateViewControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -43,77 +43,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(AdditionalImport.self) + internal static let initialScene = InitialSceneType(AdditionalImport.self) - static let Public = SceneType(AdditionalImport.self, identifier: "public") + internal static let Public = SceneType(AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(Anonymous.self) + internal static let initialScene = InitialSceneType(Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(Message.self) + internal static let initialScene = InitialSceneType(Message.self) - static let Composer = SceneType(Message.self, identifier: "Composer") + internal static let Composer = SceneType(Message.self, identifier: "Composer") - static let MessagesList = SceneType(Message.self, identifier: "MessagesList") + internal static let MessagesList = SceneType(Message.self, identifier: "MessagesList") - static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") + internal static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") - static let URLChooser = SceneType(Message.self, identifier: "URLChooser") + internal static let URLChooser = SceneType(Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") + internal static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(Wizard.self) + internal static let initialScene = InitialSceneType(Wizard.self) - static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") + internal static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") - static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") + internal static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") - static let Preferences = SceneType(Wizard.self, identifier: "Preferences") + internal static let Preferences = SceneType(Wizard.self, identifier: "Preferences") - static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") + internal static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") } } -enum XCTStoryboardsSegue { - enum AdditionalImport: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum AdditionalImport: String, SegueType { case Private = "private" } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case CustomBack case Embed case NonCustom case ShowNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case ShowPassword } } diff --git a/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module-need-extra-definitions.swift index 05075fa..3ad0a74 100644 --- a/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module-need-extra-definitions.swift @@ -9,21 +9,21 @@ import LocationPicker // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateViewControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,77 +42,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(AdditionalImport.self) + internal static let initialScene = InitialSceneType(AdditionalImport.self) - static let Public = SceneType(AdditionalImport.self, identifier: "public") + internal static let Public = SceneType(AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(Anonymous.self) + internal static let initialScene = InitialSceneType(Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(Message.self) + internal static let initialScene = InitialSceneType(Message.self) - static let Composer = SceneType(Message.self, identifier: "Composer") + internal static let Composer = SceneType(Message.self, identifier: "Composer") - static let MessagesList = SceneType(Message.self, identifier: "MessagesList") + internal static let MessagesList = SceneType(Message.self, identifier: "MessagesList") - static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") + internal static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") - static let URLChooser = SceneType(Message.self, identifier: "URLChooser") + internal static let URLChooser = SceneType(Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") + internal static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(Wizard.self) + internal static let initialScene = InitialSceneType(Wizard.self) - static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") + internal static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") - static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") + internal static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") - static let Preferences = SceneType(Wizard.self, identifier: "Preferences") + internal static let Preferences = SceneType(Wizard.self, identifier: "Preferences") - static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") + internal static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case Private = "private" } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case CustomBack case Embed case NonCustom case ShowNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case ShowPassword } } diff --git a/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module.swift b/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module.swift index dc789d7..2f61ecd 100644 --- a/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-iOS/swift2-context-all-ignore-module.swift @@ -9,21 +9,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateViewControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,77 +42,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(AdditionalImport.self) + internal static let initialScene = InitialSceneType(AdditionalImport.self) - static let Public = SceneType(AdditionalImport.self, identifier: "public") + internal static let Public = SceneType(AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(Anonymous.self) + internal static let initialScene = InitialSceneType(Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(Message.self) + internal static let initialScene = InitialSceneType(Message.self) - static let Composer = SceneType(Message.self, identifier: "Composer") + internal static let Composer = SceneType(Message.self, identifier: "Composer") - static let MessagesList = SceneType(Message.self, identifier: "MessagesList") + internal static let MessagesList = SceneType(Message.self, identifier: "MessagesList") - static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") + internal static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") - static let URLChooser = SceneType(Message.self, identifier: "URLChooser") + internal static let URLChooser = SceneType(Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") + internal static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(Wizard.self) + internal static let initialScene = InitialSceneType(Wizard.self) - static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") + internal static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") - static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") + internal static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") - static let Preferences = SceneType(Wizard.self, identifier: "Preferences") + internal static let Preferences = SceneType(Wizard.self, identifier: "Preferences") - static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") + internal static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case Private = "private" } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case CustomBack case Embed case NonCustom case ShowNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case ShowPassword } } diff --git a/Tests/Expected/Storyboards-iOS/swift2-context-all.swift b/Tests/Expected/Storyboards-iOS/swift2-context-all.swift index 4edd831..12b4c43 100644 --- a/Tests/Expected/Storyboards-iOS/swift2-context-all.swift +++ b/Tests/Expected/Storyboards-iOS/swift2-context-all.swift @@ -10,21 +10,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateViewControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -43,77 +43,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(AdditionalImport.self) + internal static let initialScene = InitialSceneType(AdditionalImport.self) - static let Public = SceneType(AdditionalImport.self, identifier: "public") + internal static let Public = SceneType(AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(Anonymous.self) + internal static let initialScene = InitialSceneType(Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(Message.self) + internal static let initialScene = InitialSceneType(Message.self) - static let Composer = SceneType(Message.self, identifier: "Composer") + internal static let Composer = SceneType(Message.self, identifier: "Composer") - static let MessagesList = SceneType(Message.self, identifier: "MessagesList") + internal static let MessagesList = SceneType(Message.self, identifier: "MessagesList") - static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") + internal static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") - static let URLChooser = SceneType(Message.self, identifier: "URLChooser") + internal static let URLChooser = SceneType(Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") + internal static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(Wizard.self) + internal static let initialScene = InitialSceneType(Wizard.self) - static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") + internal static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") - static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") + internal static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") - static let Preferences = SceneType(Wizard.self, identifier: "Preferences") + internal static let Preferences = SceneType(Wizard.self, identifier: "Preferences") - static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") + internal static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case Private = "private" } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case CustomBack case Embed case NonCustom case ShowNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case ShowPassword } } diff --git a/Tests/Expected/Storyboards-iOS/swift3-context-all-customname.swift b/Tests/Expected/Storyboards-iOS/swift3-context-all-customname.swift index 1afa01d..3ba6052 100644 --- a/Tests/Expected/Storyboards-iOS/swift3-context-all-customname.swift +++ b/Tests/Expected/Storyboards-iOS/swift3-context-all-customname.swift @@ -10,21 +10,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") } @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -43,77 +43,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum XCTStoryboardsSegue { - enum AdditionalImport: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module-need-extra-definitions.swift index f8d62df..72a5051 100644 --- a/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module-need-extra-definitions.swift @@ -9,21 +9,21 @@ import LocationPicker // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -42,77 +42,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module.swift b/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module.swift index 2572e78..c422999 100644 --- a/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-iOS/swift3-context-all-ignore-module.swift @@ -9,21 +9,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -42,77 +42,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift3-context-all.swift b/Tests/Expected/Storyboards-iOS/swift3-context-all.swift index a2c1cc0..f3a739e 100644 --- a/Tests/Expected/Storyboards-iOS/swift3-context-all.swift +++ b/Tests/Expected/Storyboards-iOS/swift3-context-all.swift @@ -10,21 +10,21 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") } @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -43,77 +43,77 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift4-context-all-customname.swift b/Tests/Expected/Storyboards-iOS/swift4-context-all-customname.swift index 24b44b5..9eebf43 100644 --- a/Tests/Expected/Storyboards-iOS/swift4-context-all-customname.swift +++ b/Tests/Expected/Storyboards-iOS/swift4-context-all-customname.swift @@ -10,22 +10,22 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { let name = self.storyboardName return UIStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = self.identifier guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") @@ -34,10 +34,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -45,9 +45,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = segue.rawValue performSegue(withIdentifier: identifier, sender: sender) @@ -55,68 +55,68 @@ extension UIViewController { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum XCTStoryboardsSegue { - enum AdditionalImport: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module-need-extra-definitions.swift index 77ce87d..c2b3871 100644 --- a/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module-need-extra-definitions.swift @@ -9,22 +9,22 @@ import LocationPicker // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { let name = self.storyboardName return UIStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = self.identifier guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") @@ -33,10 +33,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -44,9 +44,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = segue.rawValue performSegue(withIdentifier: identifier, sender: sender) @@ -54,68 +54,68 @@ extension UIViewController { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module.swift b/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module.swift index d0aca6c..35e5aa1 100644 --- a/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-iOS/swift4-context-all-ignore-module.swift @@ -9,22 +9,22 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { let name = self.storyboardName return UIStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = self.identifier guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") @@ -33,10 +33,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -44,9 +44,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = segue.rawValue performSegue(withIdentifier: identifier, sender: sender) @@ -54,68 +54,68 @@ extension UIViewController { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-iOS/swift4-context-all.swift b/Tests/Expected/Storyboards-iOS/swift4-context-all.swift index f4d08f9..4e84dcd 100644 --- a/Tests/Expected/Storyboards-iOS/swift4-context-all.swift +++ b/Tests/Expected/Storyboards-iOS/swift4-context-all.swift @@ -10,22 +10,22 @@ import SlackTextViewController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: UIStoryboard { let name = self.storyboardName return UIStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = self.identifier guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") @@ -34,10 +34,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { fatalError("ViewController is not of the expected class \(T.self).") } @@ -45,9 +45,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension UIViewController { +internal extension UIViewController { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = segue.rawValue performSegue(withIdentifier: identifier, sender: sender) @@ -55,68 +55,68 @@ extension UIViewController { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + internal static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) - static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + internal static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" - static let initialScene = InitialSceneType(storyboard: Anonymous.self) + internal static let initialScene = InitialSceneType(storyboard: Anonymous.self) } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let initialScene = InitialSceneType(storyboard: Message.self) + internal static let initialScene = InitialSceneType(storyboard: Message.self) - static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + internal static let composer = SceneType(storyboard: Message.self, identifier: "Composer") - static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + internal static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") - static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + internal static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") - static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + internal static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + internal static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") } - enum Wizard: StoryboardType { - static let storyboardName = "Wizard" + internal enum Wizard: StoryboardType { + internal static let storyboardName = "Wizard" - static let initialScene = InitialSceneType(storyboard: Wizard.self) + internal static let initialScene = InitialSceneType(storyboard: Wizard.self) - static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + internal static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") - static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + internal static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") - static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + internal static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") - static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + internal static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") } } -enum StoryboardSegue { - enum AdditionalImport: String, SegueType { +internal enum StoryboardSegue { + internal enum AdditionalImport: String, SegueType { case `private` } - enum Message: String, SegueType { + internal enum Message: String, SegueType { case customBack = "CustomBack" case embed = "Embed" case nonCustom = "NonCustom" case showNavCtrl = "Show-NavCtrl" } - enum Wizard: String, SegueType { + internal enum Wizard: String, SegueType { case showPassword = "ShowPassword" } } diff --git a/Tests/Expected/Storyboards-macOS/swift2-context-all-customname.swift b/Tests/Expected/Storyboards-macOS/swift2-context-all-customname.swift index da2a0ec..3c1cd0c 100644 --- a/Tests/Expected/Storyboards-macOS/swift2-context-all-customname.swift +++ b/Tests/Expected/Storyboards-macOS/swift2-context-all-customname.swift @@ -9,21 +9,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,55 +42,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier?(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let Private = SceneType(AdditionalImport.self, identifier: "private") + internal static let Private = SceneType(AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") + internal static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") - static let MessageList = SceneType(Message.self, identifier: "MessageList") + internal static let MessageList = SceneType(Message.self, identifier: "MessageList") - static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") + internal static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") - static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") + internal static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") - static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") + internal static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") - static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") + internal static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") + internal static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") - static let Window = SceneType(Placeholder.self, identifier: "Window") + internal static let Window = SceneType(Placeholder.self, identifier: "Window") } } -enum XCTStoryboardsSegue { - enum Message: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum Message: String, SegueType { case Embed case Modal case Popover diff --git a/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module-need-extra-definitions.swift index 6d0bd89..9f047ef 100644 --- a/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module-need-extra-definitions.swift @@ -8,21 +8,21 @@ import FadeSegue // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -30,10 +30,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -41,55 +41,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier?(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let Private = SceneType(AdditionalImport.self, identifier: "private") + internal static let Private = SceneType(AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") + internal static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") - static let MessageList = SceneType(Message.self, identifier: "MessageList") + internal static let MessageList = SceneType(Message.self, identifier: "MessageList") - static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") + internal static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") - static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") + internal static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") - static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") + internal static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") - static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") + internal static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") + internal static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") - static let Window = SceneType(Placeholder.self, identifier: "Window") + internal static let Window = SceneType(Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case Embed case Modal case Popover diff --git a/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module.swift b/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module.swift index 099453a..54e670b 100644 --- a/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-macOS/swift2-context-all-ignore-module.swift @@ -8,21 +8,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -30,10 +30,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -41,55 +41,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier?(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let Private = SceneType(AdditionalImport.self, identifier: "private") + internal static let Private = SceneType(AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") + internal static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") - static let MessageList = SceneType(Message.self, identifier: "MessageList") + internal static let MessageList = SceneType(Message.self, identifier: "MessageList") - static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") + internal static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") - static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") + internal static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") - static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") + internal static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") - static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") + internal static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") + internal static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") - static let Window = SceneType(Placeholder.self, identifier: "Window") + internal static let Window = SceneType(Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case Embed case Modal case Popover diff --git a/Tests/Expected/Storyboards-macOS/swift2-context-all.swift b/Tests/Expected/Storyboards-macOS/swift2-context-all.swift index 438e553..be7e43f 100644 --- a/Tests/Expected/Storyboards-macOS/swift2-context-all.swift +++ b/Tests/Expected/Storyboards-macOS/swift2-context-all.swift @@ -9,21 +9,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateControllerWithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - var controller: T { + internal var controller: T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,55 +42,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier?(segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let Private = SceneType(AdditionalImport.self, identifier: "private") + internal static let Private = SceneType(AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + internal static let Dependent = SceneType(Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") + internal static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") - static let MessageList = SceneType(Message.self, identifier: "MessageList") + internal static let MessageList = SceneType(Message.self, identifier: "MessageList") - static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") + internal static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") - static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") + internal static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") - static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") + internal static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") - static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") + internal static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") + internal static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") - static let Window = SceneType(Placeholder.self, identifier: "Window") + internal static let Window = SceneType(Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case Embed case Modal case Popover diff --git a/Tests/Expected/Storyboards-macOS/swift3-context-all-customname.swift b/Tests/Expected/Storyboards-macOS/swift3-context-all-customname.swift index 771bee3..91860f1 100644 --- a/Tests/Expected/Storyboards-macOS/swift3-context-all-customname.swift +++ b/Tests/Expected/Storyboards-macOS/swift3-context-all-customname.swift @@ -9,21 +9,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,55 +42,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue?(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum XCTStoryboardsSegue { - enum Message: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module-need-extra-definitions.swift index f99511a..17e5e3c 100644 --- a/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module-need-extra-definitions.swift @@ -8,21 +8,21 @@ import FadeSegue // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -30,10 +30,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -41,55 +41,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue?(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module.swift b/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module.swift index 3f7c9c5..8e30186 100644 --- a/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-macOS/swift3-context-all-ignore-module.swift @@ -8,21 +8,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -30,10 +30,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -41,55 +41,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue?(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift3-context-all.swift b/Tests/Expected/Storyboards-macOS/swift3-context-all.swift index 45ca220..aa03585 100644 --- a/Tests/Expected/Storyboards-macOS/swift3-context-all.swift +++ b/Tests/Expected/Storyboards-macOS/swift3-context-all.swift @@ -9,21 +9,21 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { return NSStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -31,10 +31,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -42,55 +42,55 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue?(withIdentifier: segue.rawValue, sender: sender) } } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift4-context-all-customname.swift b/Tests/Expected/Storyboards-macOS/swift4-context-all-customname.swift index 22210b9..0c40bb2 100644 --- a/Tests/Expected/Storyboards-macOS/swift4-context-all-customname.swift +++ b/Tests/Expected/Storyboards-macOS/swift4-context-all-customname.swift @@ -9,22 +9,22 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { let name = NSStoryboard.Name(self.storyboardName) return NSStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = NSStoryboard.SceneIdentifier(self.identifier) guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") @@ -33,10 +33,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -44,9 +44,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = NSStoryboardSegue.Identifier(segue.rawValue) performSegue?(withIdentifier: identifier, sender: sender) @@ -54,46 +54,46 @@ extension NSSeguePerforming { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum XCTStoryboardsScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum XCTStoryboardsScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum XCTStoryboardsSegue { - enum Message: String, SegueType { +internal enum XCTStoryboardsSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module-need-extra-definitions.swift b/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module-need-extra-definitions.swift index 8d9daa9..4a166df 100644 --- a/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module-need-extra-definitions.swift +++ b/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module-need-extra-definitions.swift @@ -8,22 +8,22 @@ import FadeSegue // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { let name = NSStoryboard.Name(self.storyboardName) return NSStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = NSStoryboard.SceneIdentifier(self.identifier) guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -43,9 +43,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = NSStoryboardSegue.Identifier(segue.rawValue) performSegue?(withIdentifier: identifier, sender: sender) @@ -53,46 +53,46 @@ extension NSSeguePerforming { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module.swift b/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module.swift index ea5b6f8..3e73c6d 100644 --- a/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module.swift +++ b/Tests/Expected/Storyboards-macOS/swift4-context-all-ignore-module.swift @@ -8,22 +8,22 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { let name = NSStoryboard.Name(self.storyboardName) return NSStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = NSStoryboard.SceneIdentifier(self.identifier) guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") @@ -32,10 +32,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -43,9 +43,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = NSStoryboardSegue.Identifier(segue.rawValue) performSegue?(withIdentifier: identifier, sender: sender) @@ -53,46 +53,46 @@ extension NSSeguePerforming { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Storyboards-macOS/swift4-context-all.swift b/Tests/Expected/Storyboards-macOS/swift4-context-all.swift index 0c4ad58..8f44940 100644 --- a/Tests/Expected/Storyboards-macOS/swift4-context-all.swift +++ b/Tests/Expected/Storyboards-macOS/swift4-context-all.swift @@ -9,22 +9,22 @@ import PrefsWindowController // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -protocol StoryboardType { +internal protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +internal extension StoryboardType { static var storyboard: NSStoryboard { let name = NSStoryboard.Name(self.storyboardName) return NSStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +internal struct SceneType { + internal let storyboard: StoryboardType.Type + internal let identifier: String - func instantiate() -> T { + internal func instantiate() -> T { let identifier = NSStoryboard.SceneIdentifier(self.identifier) guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") @@ -33,10 +33,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +internal struct InitialSceneType { + internal let storyboard: StoryboardType.Type - func instantiate() -> T { + internal func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -44,9 +44,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +internal protocol SegueType: RawRepresentable { } -extension NSSeguePerforming { +internal extension NSSeguePerforming { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = NSStoryboardSegue.Identifier(segue.rawValue) performSegue?(withIdentifier: identifier, sender: sender) @@ -54,46 +54,46 @@ extension NSSeguePerforming { } // swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name -enum StoryboardScene { - enum AdditionalImport: StoryboardType { - static let storyboardName = "AdditionalImport" +internal enum StoryboardScene { + internal enum AdditionalImport: StoryboardType { + internal static let storyboardName = "AdditionalImport" - static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + internal static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") } - enum Anonymous: StoryboardType { - static let storyboardName = "Anonymous" + internal enum Anonymous: StoryboardType { + internal static let storyboardName = "Anonymous" } - enum Dependency: StoryboardType { - static let storyboardName = "Dependency" + internal enum Dependency: StoryboardType { + internal static let storyboardName = "Dependency" - static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") } - enum Message: StoryboardType { - static let storyboardName = "Message" + internal enum Message: StoryboardType { + internal static let storyboardName = "Message" - static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + internal static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") - static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + internal static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") - static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + internal static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") - static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + internal static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") - static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + internal static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") - static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + internal static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") } - enum Placeholder: StoryboardType { - static let storyboardName = "Placeholder" + internal enum Placeholder: StoryboardType { + internal static let storyboardName = "Placeholder" - static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + internal static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") - static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + internal static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") } } -enum StoryboardSegue { - enum Message: String, SegueType { +internal enum StoryboardSegue { + internal enum Message: String, SegueType { case embed = "Embed" case modal = "Modal" case popover = "Popover" diff --git a/Tests/Expected/Strings/flat-swift2-context-localizable-customname.swift b/Tests/Expected/Strings/flat-swift2-context-localizable-customname.swift index fd3d7cd..0a43ad0 100644 --- a/Tests/Expected/Strings/flat-swift2-context-localizable-customname.swift +++ b/Tests/Expected/Strings/flat-swift2-context-localizable-customname.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let AlertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let AlertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let AlertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func ApplesCount(p1: Int) -> String { + internal static func ApplesCount(p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func BananasOwner(p1: Int, p2: String) -> String { + internal static func BananasOwner(p1: Int, p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let SettingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let SettingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let SettingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let SettingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let SeTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let SeTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let SettingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let SettingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift2-context-localizable-no-comments.swift b/Tests/Expected/Strings/flat-swift2-context-localizable-no-comments.swift index eeff4ca..c795bce 100644 --- a/Tests/Expected/Strings/flat-swift2-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/flat-swift2-context-localizable-no-comments.swift @@ -6,26 +6,26 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - static let AlertMessage = L10n.tr("Localizable", "alert_message") - static let AlertTitle = L10n.tr("Localizable", "alert_title") - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { +internal enum L10n { + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - static func ApplesCount(p1: Int) -> String { + internal static func ApplesCount(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } - static func BananasOwner(p1: Int, p2: String) -> String { + internal static func BananasOwner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } - static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") - static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") - static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") - static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift2-context-localizable.swift b/Tests/Expected/Strings/flat-swift2-context-localizable.swift index 0f42d3e..cd54811 100644 --- a/Tests/Expected/Strings/flat-swift2-context-localizable.swift +++ b/Tests/Expected/Strings/flat-swift2-context-localizable.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { +internal enum L10n { /// Some alert body there - static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func ApplesCount(p1: Int) -> String { + internal static func ApplesCount(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func BananasOwner(p1: Int, p2: String) -> String { + internal static func BananasOwner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift2-context-multiple.swift b/Tests/Expected/Strings/flat-swift2-context-multiple.swift index 2cf4a6e..530fcaa 100644 --- a/Tests/Expected/Strings/flat-swift2-context-multiple.swift +++ b/Tests/Expected/Strings/flat-swift2-context-multiple.swift @@ -6,50 +6,50 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func ApplesCount(p1: Int) -> String { + internal static func ApplesCount(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func BananasOwner(p1: Int, p2: String) -> String { + internal static func BananasOwner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let Multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let Multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let MultiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let MultiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let Multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let Multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let Singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let Singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let Singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let Singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift3-context-localizable-customname.swift b/Tests/Expected/Strings/flat-swift3-context-localizable-customname.swift index 3da32b6..6612a5b 100644 --- a/Tests/Expected/Strings/flat-swift3-context-localizable-customname.swift +++ b/Tests/Expected/Strings/flat-swift3-context-localizable-customname.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let alertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let alertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let alertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift3-context-localizable-no-comments.swift b/Tests/Expected/Strings/flat-swift3-context-localizable-no-comments.swift index 1cf7ec9..dc8148a 100644 --- a/Tests/Expected/Strings/flat-swift3-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/flat-swift3-context-localizable-no-comments.swift @@ -6,26 +6,26 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - static let alertMessage = L10n.tr("Localizable", "alert_message") - static let alertTitle = L10n.tr("Localizable", "alert_title") - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { +internal enum L10n { + internal static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift3-context-localizable.swift b/Tests/Expected/Strings/flat-swift3-context-localizable.swift index b9dd007..9a1f928 100644 --- a/Tests/Expected/Strings/flat-swift3-context-localizable.swift +++ b/Tests/Expected/Strings/flat-swift3-context-localizable.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { +internal enum L10n { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift3-context-multiple.swift b/Tests/Expected/Strings/flat-swift3-context-multiple.swift index c040b0b..3e052a4 100644 --- a/Tests/Expected/Strings/flat-swift3-context-multiple.swift +++ b/Tests/Expected/Strings/flat-swift3-context-multiple.swift @@ -6,50 +6,50 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let multiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let multiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift4-context-localizable-customname.swift b/Tests/Expected/Strings/flat-swift4-context-localizable-customname.swift index d99c092..ea76862 100644 --- a/Tests/Expected/Strings/flat-swift4-context-localizable-customname.swift +++ b/Tests/Expected/Strings/flat-swift4-context-localizable-customname.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let alertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let alertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let alertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = XCTLoc.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift4-context-localizable-no-comments.swift b/Tests/Expected/Strings/flat-swift4-context-localizable-no-comments.swift index 1126744..07780d3 100644 --- a/Tests/Expected/Strings/flat-swift4-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/flat-swift4-context-localizable-no-comments.swift @@ -6,26 +6,26 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - static let alertMessage = L10n.tr("Localizable", "alert_message") - static let alertTitle = L10n.tr("Localizable", "alert_title") - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { +internal enum L10n { + internal static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift4-context-localizable.swift b/Tests/Expected/Strings/flat-swift4-context-localizable.swift index 911b1bd..6aea697 100644 --- a/Tests/Expected/Strings/flat-swift4-context-localizable.swift +++ b/Tests/Expected/Strings/flat-swift4-context-localizable.swift @@ -6,37 +6,37 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { +internal enum L10n { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/flat-swift4-context-multiple.swift b/Tests/Expected/Strings/flat-swift4-context-multiple.swift index 9bbb0cf..f0b4dd1 100644 --- a/Tests/Expected/Strings/flat-swift4-context-multiple.swift +++ b/Tests/Expected/Strings/flat-swift4-context-multiple.swift @@ -6,50 +6,50 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } /// You have %d apples - static func applesCount(_ p1: Int) -> String { + internal static func applesCount(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } /// Those %d bananas belong to %@. - static func bananasOwner(_ p1: Int, _ p2: String) -> String { + internal static func bananasOwner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } /// Some Reserved Keyword there - static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") /// DeepSettings - static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") /// Settings - static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") /// Here you can change some user profile settings. - static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let multiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let multiLineNKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Strings/structured-swift2-context-localizable-customname.swift b/Tests/Expected/Strings/structured-swift2-context-localizable-customname.swift index 1ad0a92..078569e 100644 --- a/Tests/Expected/Strings/structured-swift2-context-localizable-customname.swift +++ b/Tests/Expected/Strings/structured-swift2-context-localizable-customname.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let AlertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let AlertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let AlertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func Count(p1: Int) -> String { + internal static func Count(p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func Owner(p1: Int, p2: String) -> String { + internal static func Owner(p1: Int, p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `Self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let `Self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let Deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let Deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum XCTLoc { } } - enum Even { + internal enum Even { /// Settings - static let Deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let Deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let FooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let FooterText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let HeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let HeaderTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift2-context-localizable-no-comments.swift b/Tests/Expected/Strings/structured-swift2-context-localizable-no-comments.swift index da074a5..9d923a8 100644 --- a/Tests/Expected/Strings/structured-swift2-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/structured-swift2-context-localizable-no-comments.swift @@ -6,53 +6,53 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - static let AlertMessage = L10n.tr("Localizable", "alert_message") - static let AlertTitle = L10n.tr("Localizable", "alert_title") - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { +internal enum L10n { + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { - static func Count(p1: Int) -> String { + internal enum Apples { + internal static func Count(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { - static func Owner(p1: Int, p2: String) -> String { + internal enum Bananas { + internal static func Owner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { - static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal enum NavigationBar { + internal static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { - static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal enum Is { + internal static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -63,15 +63,15 @@ enum L10n { } } - enum Even { - static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal enum Even { + internal static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { - static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal enum UserProfileSection { + internal static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift2-context-localizable.swift b/Tests/Expected/Strings/structured-swift2-context-localizable.swift index d7f91ae..5b15499 100644 --- a/Tests/Expected/Strings/structured-swift2-context-localizable.swift +++ b/Tests/Expected/Strings/structured-swift2-context-localizable.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { +internal enum L10n { /// Some alert body there - static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func Count(p1: Int) -> String { + internal static func Count(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func Owner(p1: Int, p2: String) -> String { + internal static func Owner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift2-context-multiple.swift b/Tests/Expected/Strings/structured-swift2-context-multiple.swift index d2f5892..f3b222a 100644 --- a/Tests/Expected/Strings/structured-swift2-context-multiple.swift +++ b/Tests/Expected/Strings/structured-swift2-context-multiple.swift @@ -6,62 +6,62 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let AlertMessage = L10n.tr("Localizable", "alert_message") + internal static let AlertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let AlertTitle = L10n.tr("Localizable", "alert_title") + internal static let AlertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + internal static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func Private(p1: String, p2: Int) -> String { + internal static func Private(p1: String, p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func Count(p1: Int) -> String { + internal static func Count(p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func Owner(p1: Int, p2: String) -> String { + internal static func Owner(p1: Int, p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -72,32 +72,32 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let Multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let Multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let MultiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let MultiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let Multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let Multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let Singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let Singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let Singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let Singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name diff --git a/Tests/Expected/Strings/structured-swift3-context-localizable-customname.swift b/Tests/Expected/Strings/structured-swift3-context-localizable-customname.swift index 2ab5d5d..408f1b9 100644 --- a/Tests/Expected/Strings/structured-swift3-context-localizable-customname.swift +++ b/Tests/Expected/Strings/structured-swift3-context-localizable-customname.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let alertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let alertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let alertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum XCTLoc { } } - enum Even { + internal enum Even { /// Settings - static let deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift3-context-localizable-no-comments.swift b/Tests/Expected/Strings/structured-swift3-context-localizable-no-comments.swift index d66cedd..c51ef71 100644 --- a/Tests/Expected/Strings/structured-swift3-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/structured-swift3-context-localizable-no-comments.swift @@ -6,53 +6,53 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - static let alertMessage = L10n.tr("Localizable", "alert_message") - static let alertTitle = L10n.tr("Localizable", "alert_title") - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { +internal enum L10n { + internal static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { - static func count(_ p1: Int) -> String { + internal enum Apples { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { - static func owner(_ p1: Int, _ p2: String) -> String { + internal enum Bananas { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal enum NavigationBar { + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal enum Is { + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -63,15 +63,15 @@ enum L10n { } } - enum Even { - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal enum Even { + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal enum UserProfileSection { + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift3-context-localizable.swift b/Tests/Expected/Strings/structured-swift3-context-localizable.swift index 9e97909..49e902d 100644 --- a/Tests/Expected/Strings/structured-swift3-context-localizable.swift +++ b/Tests/Expected/Strings/structured-swift3-context-localizable.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { +internal enum L10n { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift3-context-multiple.swift b/Tests/Expected/Strings/structured-swift3-context-multiple.swift index 59dda06..8affe51 100644 --- a/Tests/Expected/Strings/structured-swift3-context-multiple.swift +++ b/Tests/Expected/Strings/structured-swift3-context-multiple.swift @@ -6,62 +6,62 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -72,32 +72,32 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let multiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let multiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name diff --git a/Tests/Expected/Strings/structured-swift4-context-localizable-customname.swift b/Tests/Expected/Strings/structured-swift4-context-localizable-customname.swift index 87790a8..5e585a2 100644 --- a/Tests/Expected/Strings/structured-swift4-context-localizable-customname.swift +++ b/Tests/Expected/Strings/structured-swift4-context-localizable-customname.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum XCTLoc { +internal enum XCTLoc { /// Some alert body there - static let alertMessage = XCTLoc.tr("Localizable", "alert_message") + internal static let alertMessage = XCTLoc.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = XCTLoc.tr("Localizable", "alert_title") + internal static let alertTitle = XCTLoc.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return XCTLoc.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return XCTLoc.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return XCTLoc.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return XCTLoc.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = XCTLoc.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = XCTLoc.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum XCTLoc { } } - enum Even { + internal enum Even { /// Settings - static let deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = XCTLoc.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = XCTLoc.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = XCTLoc.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift4-context-localizable-no-comments.swift b/Tests/Expected/Strings/structured-swift4-context-localizable-no-comments.swift index 810701c..ee393c5 100644 --- a/Tests/Expected/Strings/structured-swift4-context-localizable-no-comments.swift +++ b/Tests/Expected/Strings/structured-swift4-context-localizable-no-comments.swift @@ -6,53 +6,53 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - static let alertMessage = L10n.tr("Localizable", "alert_message") - static let alertTitle = L10n.tr("Localizable", "alert_title") - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { +internal enum L10n { + internal static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { - static func count(_ p1: Int) -> String { + internal enum Apples { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { - static func owner(_ p1: Int, _ p2: String) -> String { + internal enum Bananas { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal enum NavigationBar { + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal enum Is { + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -63,15 +63,15 @@ enum L10n { } } - enum Even { - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal enum Even { + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal enum UserProfileSection { + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift4-context-localizable.swift b/Tests/Expected/Strings/structured-swift4-context-localizable.swift index fc10c6b..4f369c2 100644 --- a/Tests/Expected/Strings/structured-swift4-context-localizable.swift +++ b/Tests/Expected/Strings/structured-swift4-context-localizable.swift @@ -6,61 +6,61 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { +internal enum L10n { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -71,18 +71,18 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } diff --git a/Tests/Expected/Strings/structured-swift4-context-multiple.swift b/Tests/Expected/Strings/structured-swift4-context-multiple.swift index cb610ce..e2c7c9e 100644 --- a/Tests/Expected/Strings/structured-swift4-context-multiple.swift +++ b/Tests/Expected/Strings/structured-swift4-context-multiple.swift @@ -6,62 +6,62 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name -enum L10n { - enum Localizable { +internal enum L10n { + internal enum Localizable { /// Some alert body there - static let alertMessage = L10n.tr("Localizable", "alert_message") + internal static let alertMessage = L10n.tr("Localizable", "alert_message") /// Title of the alert - static let alertTitle = L10n.tr("Localizable", "alert_title") + internal static let alertTitle = L10n.tr("Localizable", "alert_title") /// These are %3$@'s %1$d %2$@. - static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + internal static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) } /// Hello, my name is %@ and I'm %d - static func `private`(_ p1: String, _ p2: Int) -> String { + internal static func `private`(_ p1: String, _ p2: Int) -> String { return L10n.tr("Localizable", "private", p1, p2) } - enum Apples { + internal enum Apples { /// You have %d apples - static func count(_ p1: Int) -> String { + internal static func count(_ p1: Int) -> String { return L10n.tr("Localizable", "apples.count", p1) } } - enum Bananas { + internal enum Bananas { /// Those %d bananas belong to %@. - static func owner(_ p1: Int, _ p2: String) -> String { + internal static func owner(_ p1: Int, _ p2: String) -> String { return L10n.tr("Localizable", "bananas.owner", p1, p2) } } - enum Settings { + internal enum Settings { - enum NavigationBar { + internal enum NavigationBar { /// Some Reserved Keyword there - static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + internal static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") - enum Title { + internal enum Title { - enum Deeper { + internal enum Deeper { - enum Than { + internal enum Than { - enum We { + internal enum We { - enum Can { + internal enum Can { - enum Handle { + internal enum Handle { - enum No { + internal enum No { - enum Really { + internal enum Really { - enum This { + internal enum This { - enum Is { + internal enum Is { /// DeepSettings - static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + internal static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") } } } @@ -72,32 +72,32 @@ enum L10n { } } - enum Even { + internal enum Even { /// Settings - static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + internal static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") } } } - enum UserProfileSection { + internal enum UserProfileSection { /// Here you can change some user profile settings. - static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + internal static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") /// User Profile Settings - static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + internal static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") } } } - enum LocMultiline { + internal enum LocMultiline { /// multi\nline - static let multiline = L10n.tr("LocMultiline", "MULTILINE") + internal static let multiline = L10n.tr("LocMultiline", "MULTILINE") /// test - static let multiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") + internal static let multiLineKey = L10n.tr("LocMultiline", "multiLine\nKey") /// another\nmulti\n line - static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") + internal static let multiline2 = L10n.tr("LocMultiline", "MULTILINE2") /// single line - static let singleline = L10n.tr("LocMultiline", "SINGLELINE") + internal static let singleline = L10n.tr("LocMultiline", "SINGLELINE") /// another single line - static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") + internal static let singleline2 = L10n.tr("LocMultiline", "SINGLELINE2") } } // swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name diff --git a/Tests/Expected/XCAssets/swift2-context-all-customname.swift b/Tests/Expected/XCAssets/swift2-context-all-customname.swift index 6880c8e..c0ddf57 100644 --- a/Tests/Expected/XCAssets/swift2-context-all-customname.swift +++ b/Tests/Expected/XCAssets/swift2-context-all-customname.swift @@ -2,22 +2,22 @@ #if os(OSX) import AppKit.NSImage - typealias XCTImage = NSImage + internal typealias XCTImage = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias XCTImage = UIImage + internal typealias XCTImage = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "XCTImageAsset") -typealias XCTAssetsType = XCTImageAsset +internal typealias XCTAssetsType = XCTImageAsset -struct XCTImageAsset { - private(set) var name: String +internal struct XCTImageAsset { + internal private(set) var name: String - var image: XCTImage { + internal var image: XCTImage { let bundle = NSBundle(forClass: BundleToken.self) #if os(iOS) || os(tvOS) let image = XCTImage(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) @@ -31,58 +31,58 @@ struct XCTImageAsset { } } -struct XCTColorAsset { - fileprivate(set) var name: String +internal struct XCTColorAsset { + internal fileprivate(set) var name: String } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum XCTAssets { - enum Colors { - enum _24Vision { - static let Background = XCTColorAsset(name: "24Vision/Background") - static let Primary = XCTColorAsset(name: "24Vision/Primary") +internal enum XCTAssets { + internal enum Colors { + internal enum _24Vision { + internal static let Background = XCTColorAsset(name: "24Vision/Background") + internal static let Primary = XCTColorAsset(name: "24Vision/Primary") } - static let Orange = XCTImageAsset(name: "Orange") - enum Vengo { - static let Primary = XCTColorAsset(name: "Vengo/Primary") - static let Tint = XCTColorAsset(name: "Vengo/Tint") + internal static let Orange = XCTImageAsset(name: "Orange") + internal enum Vengo { + internal static let Primary = XCTColorAsset(name: "Vengo/Primary") + internal static let Tint = XCTColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ _24Vision.Background, _24Vision.Primary, Vengo.Primary, Vengo.Tint, ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ Orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } - enum Images { - enum Exotic { - static let Banana = XCTImageAsset(name: "Exotic/Banana") - static let Mango = XCTImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let Banana = XCTImageAsset(name: "Exotic/Banana") + internal static let Mango = XCTImageAsset(name: "Exotic/Mango") } - enum Round { - static let Apricot = XCTImageAsset(name: "Round/Apricot") - enum Red { - static let Apple = XCTImageAsset(name: "Round/Apple") - enum Double { - static let Cherry = XCTImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let Apricot = XCTImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let Apple = XCTImageAsset(name: "Round/Apple") + internal enum Double { + internal static let Cherry = XCTImageAsset(name: "Round/Double/Cherry") } - static let Tomato = XCTImageAsset(name: "Round/Tomato") + internal static let Tomato = XCTImageAsset(name: "Round/Tomato") } } - static let Private = XCTImageAsset(name: "private") + internal static let Private = XCTImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ Exotic.Banana, Exotic.Mango, Round.Apricot, @@ -93,12 +93,12 @@ enum XCTAssets { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension XCTImage { +internal extension XCTImage { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the XCTImageAsset.image property") diff --git a/Tests/Expected/XCAssets/swift2-context-all-no-all-values.swift b/Tests/Expected/XCAssets/swift2-context-all-no-all-values.swift index a349b51..e4836e3 100644 --- a/Tests/Expected/XCAssets/swift2-context-all-no-all-values.swift +++ b/Tests/Expected/XCAssets/swift2-context-all-no-all-values.swift @@ -2,22 +2,22 @@ #if os(OSX) import AppKit.NSImage - typealias Image = NSImage + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias Image = UIImage + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - private(set) var name: String +internal struct ImageAsset { + internal private(set) var name: String - var image: Image { + internal var image: Image { let bundle = NSBundle(forClass: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) @@ -31,44 +31,44 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let Background = ColorAsset(name: "24Vision/Background") - static let Primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let Background = ColorAsset(name: "24Vision/Background") + internal static let Primary = ColorAsset(name: "24Vision/Primary") } - static let Orange = ImageAsset(name: "Orange") - enum Vengo { - static let Primary = ColorAsset(name: "Vengo/Primary") - static let Tint = ColorAsset(name: "Vengo/Tint") + internal static let Orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let Primary = ColorAsset(name: "Vengo/Primary") + internal static let Tint = ColorAsset(name: "Vengo/Tint") } } - enum Images { - enum Exotic { - static let Banana = ImageAsset(name: "Exotic/Banana") - static let Mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let Banana = ImageAsset(name: "Exotic/Banana") + internal static let Mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let Apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let Apple = ImageAsset(name: "Round/Apple") - enum Double { - static let Cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let Apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let Apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let Cherry = ImageAsset(name: "Round/Double/Cherry") } - static let Tomato = ImageAsset(name: "Round/Tomato") + internal static let Tomato = ImageAsset(name: "Round/Tomato") } } - static let Private = ImageAsset(name: "private") + internal static let Private = ImageAsset(name: "private") } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") diff --git a/Tests/Expected/XCAssets/swift2-context-all.swift b/Tests/Expected/XCAssets/swift2-context-all.swift index 497c95c..03ad449 100644 --- a/Tests/Expected/XCAssets/swift2-context-all.swift +++ b/Tests/Expected/XCAssets/swift2-context-all.swift @@ -2,22 +2,22 @@ #if os(OSX) import AppKit.NSImage - typealias Image = NSImage + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias Image = UIImage + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - private(set) var name: String +internal struct ImageAsset { + internal private(set) var name: String - var image: Image { + internal var image: Image { let bundle = NSBundle(forClass: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) @@ -31,58 +31,58 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let Background = ColorAsset(name: "24Vision/Background") - static let Primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let Background = ColorAsset(name: "24Vision/Background") + internal static let Primary = ColorAsset(name: "24Vision/Primary") } - static let Orange = ImageAsset(name: "Orange") - enum Vengo { - static let Primary = ColorAsset(name: "Vengo/Primary") - static let Tint = ColorAsset(name: "Vengo/Tint") + internal static let Orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let Primary = ColorAsset(name: "Vengo/Primary") + internal static let Tint = ColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ _24Vision.Background, _24Vision.Primary, Vengo.Primary, Vengo.Tint, ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ Orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } - enum Images { - enum Exotic { - static let Banana = ImageAsset(name: "Exotic/Banana") - static let Mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let Banana = ImageAsset(name: "Exotic/Banana") + internal static let Mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let Apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let Apple = ImageAsset(name: "Round/Apple") - enum Double { - static let Cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let Apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let Apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let Cherry = ImageAsset(name: "Round/Double/Cherry") } - static let Tomato = ImageAsset(name: "Round/Tomato") + internal static let Tomato = ImageAsset(name: "Round/Tomato") } } - static let Private = ImageAsset(name: "private") + internal static let Private = ImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ Exotic.Banana, Exotic.Mango, Round.Apricot, @@ -93,12 +93,12 @@ enum Asset { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") diff --git a/Tests/Expected/XCAssets/swift3-context-all-customname.swift b/Tests/Expected/XCAssets/swift3-context-all-customname.swift index 0c88c5b..75732b0 100644 --- a/Tests/Expected/XCAssets/swift3-context-all-customname.swift +++ b/Tests/Expected/XCAssets/swift3-context-all-customname.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias XCTColor = NSColor - typealias XCTImage = NSImage + internal typealias XCTColor = NSColor + internal typealias XCTImage = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias XCTColor = UIColor - typealias XCTImage = UIImage + internal typealias XCTColor = UIColor + internal typealias XCTImage = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "XCTImageAsset") -typealias XCTAssetsType = XCTImageAsset +internal typealias XCTAssetsType = XCTImageAsset -struct XCTImageAsset { - fileprivate(set) var name: String +internal struct XCTImageAsset { + internal fileprivate(set) var name: String - var image: XCTImage { + internal var image: XCTImage { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = XCTImage(named: name, in: bundle, compatibleWith: nil) @@ -33,65 +33,65 @@ struct XCTImageAsset { } } -struct XCTColorAsset { - fileprivate(set) var name: String +internal struct XCTColorAsset { + internal fileprivate(set) var name: String #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: XCTColor { + internal var color: XCTColor { return XCTColor(asset: self) } #endif } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum XCTAssets { - enum Colors { - enum _24Vision { - static let background = XCTColorAsset(name: "24Vision/Background") - static let primary = XCTColorAsset(name: "24Vision/Primary") +internal enum XCTAssets { + internal enum Colors { + internal enum _24Vision { + internal static let background = XCTColorAsset(name: "24Vision/Background") + internal static let primary = XCTColorAsset(name: "24Vision/Primary") } - static let orange = XCTImageAsset(name: "Orange") - enum Vengo { - static let primary = XCTColorAsset(name: "Vengo/Primary") - static let tint = XCTColorAsset(name: "Vengo/Tint") + internal static let orange = XCTImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = XCTColorAsset(name: "Vengo/Primary") + internal static let tint = XCTColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ _24Vision.background, _24Vision.primary, Vengo.primary, Vengo.tint, ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } - enum Images { - enum Exotic { - static let banana = XCTImageAsset(name: "Exotic/Banana") - static let mango = XCTImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = XCTImageAsset(name: "Exotic/Banana") + internal static let mango = XCTImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = XCTImageAsset(name: "Round/Apricot") - enum Red { - static let apple = XCTImageAsset(name: "Round/Apple") - enum Double { - static let cherry = XCTImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = XCTImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = XCTImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = XCTImageAsset(name: "Round/Double/Cherry") } - static let tomato = XCTImageAsset(name: "Round/Tomato") + internal static let tomato = XCTImageAsset(name: "Round/Tomato") } } - static let `private` = XCTImageAsset(name: "private") + internal static let `private` = XCTImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ Exotic.banana, Exotic.mango, Round.apricot, @@ -102,12 +102,12 @@ enum XCTAssets { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension XCTImage { +internal extension XCTImage { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the XCTImageAsset.image property") @@ -121,7 +121,7 @@ extension XCTImage { } } -extension XCTColor { +internal extension XCTColor { #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: XCTColorAsset) { diff --git a/Tests/Expected/XCAssets/swift3-context-all-no-all-values.swift b/Tests/Expected/XCAssets/swift3-context-all-no-all-values.swift index 859b829..2aa4ab2 100644 --- a/Tests/Expected/XCAssets/swift3-context-all-no-all-values.swift +++ b/Tests/Expected/XCAssets/swift3-context-all-no-all-values.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias AssetColorTypeAlias = NSColor - typealias Image = NSImage + internal typealias AssetColorTypeAlias = NSColor + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias AssetColorTypeAlias = UIColor - typealias Image = UIImage + internal typealias AssetColorTypeAlias = UIColor + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - fileprivate(set) var name: String +internal struct ImageAsset { + internal fileprivate(set) var name: String - var image: Image { + internal var image: Image { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) @@ -33,51 +33,51 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: AssetColorTypeAlias { + internal var color: AssetColorTypeAlias { return AssetColorTypeAlias(asset: self) } #endif } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let background = ColorAsset(name: "24Vision/Background") - static let primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let background = ColorAsset(name: "24Vision/Background") + internal static let primary = ColorAsset(name: "24Vision/Primary") } - static let orange = ImageAsset(name: "Orange") - enum Vengo { - static let primary = ColorAsset(name: "Vengo/Primary") - static let tint = ColorAsset(name: "Vengo/Tint") + internal static let orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = ColorAsset(name: "Vengo/Primary") + internal static let tint = ColorAsset(name: "Vengo/Tint") } } - enum Images { - enum Exotic { - static let banana = ImageAsset(name: "Exotic/Banana") - static let mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = ImageAsset(name: "Exotic/Banana") + internal static let mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let apple = ImageAsset(name: "Round/Apple") - enum Double { - static let cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = ImageAsset(name: "Round/Double/Cherry") } - static let tomato = ImageAsset(name: "Round/Tomato") + internal static let tomato = ImageAsset(name: "Round/Tomato") } } - static let `private` = ImageAsset(name: "private") + internal static let `private` = ImageAsset(name: "private") } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") @@ -91,7 +91,7 @@ extension Image { } } -extension AssetColorTypeAlias { +internal extension AssetColorTypeAlias { #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: ColorAsset) { diff --git a/Tests/Expected/XCAssets/swift3-context-all.swift b/Tests/Expected/XCAssets/swift3-context-all.swift index 4150d60..0d410f6 100644 --- a/Tests/Expected/XCAssets/swift3-context-all.swift +++ b/Tests/Expected/XCAssets/swift3-context-all.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias AssetColorTypeAlias = NSColor - typealias Image = NSImage + internal typealias AssetColorTypeAlias = NSColor + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias AssetColorTypeAlias = UIColor - typealias Image = UIImage + internal typealias AssetColorTypeAlias = UIColor + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - fileprivate(set) var name: String +internal struct ImageAsset { + internal fileprivate(set) var name: String - var image: Image { + internal var image: Image { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) @@ -33,65 +33,65 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: AssetColorTypeAlias { + internal var color: AssetColorTypeAlias { return AssetColorTypeAlias(asset: self) } #endif } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let background = ColorAsset(name: "24Vision/Background") - static let primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let background = ColorAsset(name: "24Vision/Background") + internal static let primary = ColorAsset(name: "24Vision/Primary") } - static let orange = ImageAsset(name: "Orange") - enum Vengo { - static let primary = ColorAsset(name: "Vengo/Primary") - static let tint = ColorAsset(name: "Vengo/Tint") + internal static let orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = ColorAsset(name: "Vengo/Primary") + internal static let tint = ColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ _24Vision.background, _24Vision.primary, Vengo.primary, Vengo.tint, ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } - enum Images { - enum Exotic { - static let banana = ImageAsset(name: "Exotic/Banana") - static let mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = ImageAsset(name: "Exotic/Banana") + internal static let mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let apple = ImageAsset(name: "Round/Apple") - enum Double { - static let cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = ImageAsset(name: "Round/Double/Cherry") } - static let tomato = ImageAsset(name: "Round/Tomato") + internal static let tomato = ImageAsset(name: "Round/Tomato") } } - static let `private` = ImageAsset(name: "private") + internal static let `private` = ImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ Exotic.banana, Exotic.mango, Round.apricot, @@ -102,12 +102,12 @@ enum Asset { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") @@ -121,7 +121,7 @@ extension Image { } } -extension AssetColorTypeAlias { +internal extension AssetColorTypeAlias { #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: ColorAsset) { diff --git a/Tests/Expected/XCAssets/swift4-context-all-customname.swift b/Tests/Expected/XCAssets/swift4-context-all-customname.swift index d91ebe7..2a3725e 100644 --- a/Tests/Expected/XCAssets/swift4-context-all-customname.swift +++ b/Tests/Expected/XCAssets/swift4-context-all-customname.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias XCTColor = NSColor - typealias XCTImage = NSImage + internal typealias XCTColor = NSColor + internal typealias XCTImage = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias XCTColor = UIColor - typealias XCTImage = UIImage + internal typealias XCTColor = UIColor + internal typealias XCTImage = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "XCTImageAsset") -typealias XCTAssetsType = XCTImageAsset +internal typealias XCTAssetsType = XCTImageAsset -struct XCTImageAsset { - fileprivate(set) var name: String +internal struct XCTImageAsset { + internal fileprivate(set) var name: String - var image: XCTImage { + internal var image: XCTImage { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = XCTImage(named: name, in: bundle, compatibleWith: nil) @@ -33,63 +33,63 @@ struct XCTImageAsset { } } -struct XCTColorAsset { - fileprivate(set) var name: String +internal struct XCTColorAsset { + internal fileprivate(set) var name: String @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: XCTColor { + internal var color: XCTColor { return XCTColor(asset: self) } } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum XCTAssets { - enum Colors { - enum _24Vision { - static let background = XCTColorAsset(name: "24Vision/Background") - static let primary = XCTColorAsset(name: "24Vision/Primary") +internal enum XCTAssets { + internal enum Colors { + internal enum _24Vision { + internal static let background = XCTColorAsset(name: "24Vision/Background") + internal static let primary = XCTColorAsset(name: "24Vision/Primary") } - static let orange = XCTImageAsset(name: "Orange") - enum Vengo { - static let primary = XCTColorAsset(name: "Vengo/Primary") - static let tint = XCTColorAsset(name: "Vengo/Tint") + internal static let orange = XCTImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = XCTColorAsset(name: "Vengo/Primary") + internal static let tint = XCTColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ _24Vision.background, _24Vision.primary, Vengo.primary, Vengo.tint, ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } - enum Images { - enum Exotic { - static let banana = XCTImageAsset(name: "Exotic/Banana") - static let mango = XCTImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = XCTImageAsset(name: "Exotic/Banana") + internal static let mango = XCTImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = XCTImageAsset(name: "Round/Apricot") - enum Red { - static let apple = XCTImageAsset(name: "Round/Apple") - enum Double { - static let cherry = XCTImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = XCTImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = XCTImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = XCTImageAsset(name: "Round/Double/Cherry") } - static let tomato = XCTImageAsset(name: "Round/Tomato") + internal static let tomato = XCTImageAsset(name: "Round/Tomato") } } - static let `private` = XCTImageAsset(name: "private") + internal static let `private` = XCTImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [XCTColorAsset] = [ + internal static let allColors: [XCTColorAsset] = [ ] - static let allImages: [XCTImageAsset] = [ + internal static let allImages: [XCTImageAsset] = [ Exotic.banana, Exotic.mango, Round.apricot, @@ -100,12 +100,12 @@ enum XCTAssets { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [XCTAssetsType] = allImages + internal static let allValues: [XCTAssetsType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension XCTImage { +internal extension XCTImage { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the XCTImageAsset.image property") @@ -121,7 +121,7 @@ extension XCTImage { } } -extension XCTColor { +internal extension XCTColor { @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: XCTColorAsset) { let bundle = Bundle(for: BundleToken.self) diff --git a/Tests/Expected/XCAssets/swift4-context-all-no-all-values.swift b/Tests/Expected/XCAssets/swift4-context-all-no-all-values.swift index d4248e7..4839078 100644 --- a/Tests/Expected/XCAssets/swift4-context-all-no-all-values.swift +++ b/Tests/Expected/XCAssets/swift4-context-all-no-all-values.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias AssetColorTypeAlias = NSColor - typealias Image = NSImage + internal typealias AssetColorTypeAlias = NSColor + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias AssetColorTypeAlias = UIColor - typealias Image = UIImage + internal typealias AssetColorTypeAlias = UIColor + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - fileprivate(set) var name: String +internal struct ImageAsset { + internal fileprivate(set) var name: String - var image: Image { + internal var image: Image { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) @@ -33,49 +33,49 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: AssetColorTypeAlias { + internal var color: AssetColorTypeAlias { return AssetColorTypeAlias(asset: self) } } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let background = ColorAsset(name: "24Vision/Background") - static let primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let background = ColorAsset(name: "24Vision/Background") + internal static let primary = ColorAsset(name: "24Vision/Primary") } - static let orange = ImageAsset(name: "Orange") - enum Vengo { - static let primary = ColorAsset(name: "Vengo/Primary") - static let tint = ColorAsset(name: "Vengo/Tint") + internal static let orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = ColorAsset(name: "Vengo/Primary") + internal static let tint = ColorAsset(name: "Vengo/Tint") } } - enum Images { - enum Exotic { - static let banana = ImageAsset(name: "Exotic/Banana") - static let mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = ImageAsset(name: "Exotic/Banana") + internal static let mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let apple = ImageAsset(name: "Round/Apple") - enum Double { - static let cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = ImageAsset(name: "Round/Double/Cherry") } - static let tomato = ImageAsset(name: "Round/Tomato") + internal static let tomato = ImageAsset(name: "Round/Tomato") } } - static let `private` = ImageAsset(name: "private") + internal static let `private` = ImageAsset(name: "private") } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") @@ -91,7 +91,7 @@ extension Image { } } -extension AssetColorTypeAlias { +internal extension AssetColorTypeAlias { @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: ColorAsset) { let bundle = Bundle(for: BundleToken.self) diff --git a/Tests/Expected/XCAssets/swift4-context-all.swift b/Tests/Expected/XCAssets/swift4-context-all.swift index e20a1a8..857eb9c 100644 --- a/Tests/Expected/XCAssets/swift4-context-all.swift +++ b/Tests/Expected/XCAssets/swift4-context-all.swift @@ -2,24 +2,24 @@ #if os(OSX) import AppKit.NSImage - typealias AssetColorTypeAlias = NSColor - typealias Image = NSImage + internal typealias AssetColorTypeAlias = NSColor + internal typealias Image = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias AssetColorTypeAlias = UIColor - typealias Image = UIImage + internal typealias AssetColorTypeAlias = UIColor + internal typealias Image = UIImage #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @available(*, deprecated, renamed: "ImageAsset") -typealias AssetType = ImageAsset +internal typealias AssetType = ImageAsset -struct ImageAsset { - fileprivate(set) var name: String +internal struct ImageAsset { + internal fileprivate(set) var name: String - var image: Image { + internal var image: Image { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) @@ -33,63 +33,63 @@ struct ImageAsset { } } -struct ColorAsset { - fileprivate(set) var name: String +internal struct ColorAsset { + internal fileprivate(set) var name: String @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: AssetColorTypeAlias { + internal var color: AssetColorTypeAlias { return AssetColorTypeAlias(asset: self) } } // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum Asset { - enum Colors { - enum _24Vision { - static let background = ColorAsset(name: "24Vision/Background") - static let primary = ColorAsset(name: "24Vision/Primary") +internal enum Asset { + internal enum Colors { + internal enum _24Vision { + internal static let background = ColorAsset(name: "24Vision/Background") + internal static let primary = ColorAsset(name: "24Vision/Primary") } - static let orange = ImageAsset(name: "Orange") - enum Vengo { - static let primary = ColorAsset(name: "Vengo/Primary") - static let tint = ColorAsset(name: "Vengo/Tint") + internal static let orange = ImageAsset(name: "Orange") + internal enum Vengo { + internal static let primary = ColorAsset(name: "Vengo/Primary") + internal static let tint = ColorAsset(name: "Vengo/Tint") } // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ _24Vision.background, _24Vision.primary, Vengo.primary, Vengo.tint, ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ orange, ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } - enum Images { - enum Exotic { - static let banana = ImageAsset(name: "Exotic/Banana") - static let mango = ImageAsset(name: "Exotic/Mango") + internal enum Images { + internal enum Exotic { + internal static let banana = ImageAsset(name: "Exotic/Banana") + internal static let mango = ImageAsset(name: "Exotic/Mango") } - enum Round { - static let apricot = ImageAsset(name: "Round/Apricot") - enum Red { - static let apple = ImageAsset(name: "Round/Apple") - enum Double { - static let cherry = ImageAsset(name: "Round/Double/Cherry") + internal enum Round { + internal static let apricot = ImageAsset(name: "Round/Apricot") + internal enum Red { + internal static let apple = ImageAsset(name: "Round/Apple") + internal enum Double { + internal static let cherry = ImageAsset(name: "Round/Double/Cherry") } - static let tomato = ImageAsset(name: "Round/Tomato") + internal static let tomato = ImageAsset(name: "Round/Tomato") } } - static let `private` = ImageAsset(name: "private") + internal static let `private` = ImageAsset(name: "private") // swiftlint:disable trailing_comma - static let allColors: [ColorAsset] = [ + internal static let allColors: [ColorAsset] = [ ] - static let allImages: [ImageAsset] = [ + internal static let allImages: [ImageAsset] = [ Exotic.banana, Exotic.mango, Round.apricot, @@ -100,12 +100,12 @@ enum Asset { ] // swiftlint:enable trailing_comma @available(*, deprecated, renamed: "allImages") - static let allValues: [AssetType] = allImages + internal static let allValues: [AssetType] = allImages } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension Image { +internal extension Image { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") @@ -121,7 +121,7 @@ extension Image { } } -extension AssetColorTypeAlias { +internal extension AssetColorTypeAlias { @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: ColorAsset) { let bundle = Bundle(for: BundleToken.self) diff --git a/templates/colors/literals-swift3.stencil b/templates/colors/literals-swift3.stencil index f4a2eb8..bc9696c 100644 --- a/templates/colors/literals-swift3.stencil +++ b/templates/colors/literals-swift3.stencil @@ -2,19 +2,20 @@ {% if palettes %} {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit - {% if enumName != 'NSColor' %}enum {{enumName}} { }{% endif %} + {% if enumName != 'NSColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - {% if enumName != 'UIColor' %}enum {{enumName}} { }{% endif %} + {% if enumName != 'UIColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension {{enumName}} { +{{accessModifier}} extension {{enumName}} { {% macro h2f hex %}{{hex|hexToInt|int255toFloat}}{% endmacro %} {% macro enumBlock colors sp %} {{sp}} {% for color in colors %} diff --git a/templates/colors/literals-swift4.stencil b/templates/colors/literals-swift4.stencil index f4a2eb8..bc9696c 100644 --- a/templates/colors/literals-swift4.stencil +++ b/templates/colors/literals-swift4.stencil @@ -2,19 +2,20 @@ {% if palettes %} {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit - {% if enumName != 'NSColor' %}enum {{enumName}} { }{% endif %} + {% if enumName != 'NSColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit - {% if enumName != 'UIColor' %}enum {{enumName}} { }{% endif %} + {% if enumName != 'UIColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable identifier_name line_length type_body_length -extension {{enumName}} { +{{accessModifier}} extension {{enumName}} { {% macro h2f hex %}{{hex|hexToInt|int255toFloat}}{% endmacro %} {% macro enumBlock colors sp %} {{sp}} {% for color in colors %} diff --git a/templates/colors/swift2.stencil b/templates/colors/swift2.stencil index 16896f1..759fd62 100644 --- a/templates/colors/swift2.stencil +++ b/templates/colors/swift2.stencil @@ -2,19 +2,20 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor - typealias {{colorAlias}} = NSColor + {{accessModifier}} typealias {{colorAlias}} = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias {{colorAlias}} = UIColor + {{accessModifier}} typealias {{colorAlias}} = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -28,21 +29,21 @@ extension {{colorAlias}} { // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} -struct {{enumName}} { - let rgbaValue: UInt32 - var color: {{colorAlias}} { return {{colorAlias}}(named: self) } +{{accessModifier}} struct {{enumName}} { + {{accessModifier}} let rgbaValue: UInt32 + {{accessModifier}} var color: {{colorAlias}} { return {{colorAlias}}(named: self) } {% macro rgbaValue color %}0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}{% endmacro %} {% macro enumBlock colors sp %} {{sp}} {% for color in colors %} {{sp}} /// {{sp}} /// Alpha: {{color.alpha|hexToInt|int255toFloat|percent}}
(0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}) -{{sp}} static let {{color.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) +{{sp}} {{accessModifier}} static let {{color.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) {{sp}} {% endfor %} {% endmacro %} {% if palettes.count > 1 %} {% for palette in palettes %} - enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock palette.colors " " %} } {% endfor %} @@ -52,7 +53,7 @@ struct {{enumName}} { } // swiftlint:enable identifier_name line_length type_body_length -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(named color: {{enumName}}) { self.init(rgbaValue: color.rgbaValue) } diff --git a/templates/colors/swift3.stencil b/templates/colors/swift3.stencil index a058cce..8cb583e 100644 --- a/templates/colors/swift3.stencil +++ b/templates/colors/swift3.stencil @@ -2,19 +2,20 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor - typealias {{colorAlias}} = NSColor + {{accessModifier}} typealias {{colorAlias}} = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias {{colorAlias}} = UIColor + {{accessModifier}} typealias {{colorAlias}} = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -28,21 +29,21 @@ extension {{colorAlias}} { // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} -struct {{enumName}} { - let rgbaValue: UInt32 - var color: {{colorAlias}} { return {{colorAlias}}(named: self) } +{{accessModifier}} struct {{enumName}} { + {{accessModifier}} let rgbaValue: UInt32 + {{accessModifier}} var color: {{colorAlias}} { return {{colorAlias}}(named: self) } {% macro rgbaValue color %}0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}{% endmacro %} {% macro enumBlock colors sp %} {{sp}} {% for color in colors %} {{sp}} /// {{sp}} /// Alpha: {{color.alpha|hexToInt|int255toFloat|percent}}
(0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}) -{{sp}} static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) +{{sp}} {{accessModifier}} static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) {{sp}} {% endfor %} {% endmacro %} {% if palettes.count > 1 %} {% for palette in palettes %} - enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock palette.colors " " %} } {% endfor %} @@ -52,7 +53,7 @@ struct {{enumName}} { } // swiftlint:enable identifier_name line_length type_body_length -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(named color: {{enumName}}) { self.init(rgbaValue: color.rgbaValue) } diff --git a/templates/colors/swift4.stencil b/templates/colors/swift4.stencil index a058cce..8cb583e 100644 --- a/templates/colors/swift4.stencil +++ b/templates/colors/swift4.stencil @@ -2,19 +2,20 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor - typealias {{colorAlias}} = NSColor + {{accessModifier}} typealias {{colorAlias}} = NSColor #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIColor - typealias {{colorAlias}} = UIColor + {{accessModifier}} typealias {{colorAlias}} = UIColor #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // swiftlint:disable operator_usage_whitespace -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(rgbaValue: UInt32) { let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 @@ -28,21 +29,21 @@ extension {{colorAlias}} { // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} -struct {{enumName}} { - let rgbaValue: UInt32 - var color: {{colorAlias}} { return {{colorAlias}}(named: self) } +{{accessModifier}} struct {{enumName}} { + {{accessModifier}} let rgbaValue: UInt32 + {{accessModifier}} var color: {{colorAlias}} { return {{colorAlias}}(named: self) } {% macro rgbaValue color %}0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}{% endmacro %} {% macro enumBlock colors sp %} {{sp}} {% for color in colors %} {{sp}} /// {{sp}} /// Alpha: {{color.alpha|hexToInt|int255toFloat|percent}}
(0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}}) -{{sp}} static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) +{{sp}} {{accessModifier}} static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}(rgbaValue: {% call rgbaValue color %}) {{sp}} {% endfor %} {% endmacro %} {% if palettes.count > 1 %} {% for palette in palettes %} - enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock palette.colors " " %} } {% endfor %} @@ -52,7 +53,7 @@ struct {{enumName}} { } // swiftlint:enable identifier_name line_length type_body_length -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { convenience init(named color: {{enumName}}) { self.init(rgbaValue: color.rgbaValue) } diff --git a/templates/fonts/swift2.stencil b/templates/fonts/swift2.stencil index 9e19f61..75bb1f1 100644 --- a/templates/fonts/swift2.stencil +++ b/templates/fonts/swift2.stencil @@ -1,27 +1,28 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + {{accessModifier}} typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + {{accessModifier}} typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +{{accessModifier}} struct FontConvertible { + {{accessModifier}} let name: String + {{accessModifier}} let family: String + {{accessModifier}} let path: String - func font(size: CGFloat) -> Font! { + {{accessModifier}} func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + {{accessModifier}} func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .Process, &errorRef) @@ -33,7 +34,7 @@ struct FontConvertible { } } -extension Font { +{{accessModifier}} extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNamesForFamilyName(font.family).contains(font.name) { @@ -57,11 +58,11 @@ extension Font { {{path|basename}} {% endif %} {% endfilter %}{% endmacro %} -enum {{param.enumName|default:"FontFamily"}} { +{{accessModifier}} enum {{param.enumName|default:"FontFamily"}} { {% for family in families %} - enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% for font in family.fonts %} - static let {{font.style|swiftIdentifier:"pretty"|escapeReservedKeywords}} = FontConvertible("{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") + {{accessModifier}} static let {{font.style|swiftIdentifier:"pretty"|escapeReservedKeywords}} = FontConvertible("{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") {% endfor %} } {% endfor %} diff --git a/templates/fonts/swift3.stencil b/templates/fonts/swift3.stencil index ac35112..73e2007 100644 --- a/templates/fonts/swift3.stencil +++ b/templates/fonts/swift3.stencil @@ -1,27 +1,28 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + {{accessModifier}} typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + {{accessModifier}} typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +{{accessModifier}} struct FontConvertible { + {{accessModifier}} let name: String + {{accessModifier}} let family: String + {{accessModifier}} let path: String - func font(size: CGFloat) -> Font! { + {{accessModifier}} func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + {{accessModifier}} func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -33,7 +34,7 @@ struct FontConvertible { } } -extension Font { +{{accessModifier}} extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -57,11 +58,11 @@ extension Font { {{path|basename}} {% endif %} {% endfilter %}{% endmacro %} -enum {{param.enumName|default:"FontFamily"}} { +{{accessModifier}} enum {{param.enumName|default:"FontFamily"}} { {% for family in families %} - enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% for font in family.fonts %} - static let {{font.style|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = FontConvertible(name: "{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") + {{accessModifier}} static let {{font.style|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = FontConvertible(name: "{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") {% endfor %} } {% endfor %} diff --git a/templates/fonts/swift4.stencil b/templates/fonts/swift4.stencil index ac35112..73e2007 100644 --- a/templates/fonts/swift4.stencil +++ b/templates/fonts/swift4.stencil @@ -1,27 +1,28 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont - typealias Font = NSFont + {{accessModifier}} typealias Font = NSFont #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIFont - typealias Font = UIFont + {{accessModifier}} typealias Font = UIFont #endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length -struct FontConvertible { - let name: String - let family: String - let path: String +{{accessModifier}} struct FontConvertible { + {{accessModifier}} let name: String + {{accessModifier}} let family: String + {{accessModifier}} let path: String - func font(size: CGFloat) -> Font! { + {{accessModifier}} func font(size: CGFloat) -> Font! { return Font(font: self, size: size) } - func register() { + {{accessModifier}} func register() { guard let url = url else { return } var errorRef: Unmanaged? CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) @@ -33,7 +34,7 @@ struct FontConvertible { } } -extension Font { +{{accessModifier}} extension Font { convenience init!(font: FontConvertible, size: CGFloat) { #if os(iOS) || os(tvOS) || os(watchOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { @@ -57,11 +58,11 @@ extension Font { {{path|basename}} {% endif %} {% endfilter %}{% endmacro %} -enum {{param.enumName|default:"FontFamily"}} { +{{accessModifier}} enum {{param.enumName|default:"FontFamily"}} { {% for family in families %} - enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{family.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% for font in family.fonts %} - static let {{font.style|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = FontConvertible(name: "{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") + {{accessModifier}} static let {{font.style|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = FontConvertible(name: "{{font.name}}", family: "{{family.name}}", path: "{% call transformPath font.path %}") {% endfor %} } {% endfor %} diff --git a/templates/storyboards/swift2.stencil b/templates/storyboards/swift2.stencil index 47d99c7..ea4ea90 100644 --- a/templates/storyboards/swift2.stencil +++ b/templates/storyboards/swift2.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} @@ -15,21 +16,21 @@ import {{module}} // swiftlint:disable file_length {# This first part of the code is static, same every time whatever Storyboard you have #} -protocol StoryboardType { +{{accessModifier}} protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +{{accessModifier}} extension StoryboardType { static var storyboard: {{prefix}}Storyboard { return {{prefix}}Storyboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +{{accessModifier}} struct SceneType { + {{accessModifier}} let storyboard: StoryboardType.Type + {{accessModifier}} let identifier: String - var controller: T { + {{accessModifier}} var controller: T { guard let controller = storyboard.storyboard.instantiate{{controller}}WithIdentifier(identifier) as? T else { fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") } @@ -37,10 +38,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +{{accessModifier}} struct InitialSceneType { + {{accessModifier}} let storyboard: StoryboardType.Type - var controller: T { + {{accessModifier}} var controller: T { guard let controller = storyboard.storyboard.instantiateInitial{{controller}}() as? T else { fatalError("Controller is not of the expected class \(T.self).") } @@ -48,9 +49,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +{{accessModifier}} protocol SegueType: RawRepresentable { } -extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { +{{accessModifier}} extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { func performSegue(segue: S, sender: AnyObject? = nil) { performSegueWithIdentifier{% if isAppKit %}?{% endif %}(segue.rawValue, sender: sender) } @@ -71,29 +72,29 @@ extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif % {{prefix}}{{scene.baseType}} {% endif %} {% endfilter %}{% endmacro %} -enum {{sceneEnumName}} { +{{accessModifier}} enum {{sceneEnumName}} { {% for storyboard in storyboards %} {% set storyboardName %}{{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}{% endset %} - enum {{storyboardName}}: StoryboardType { - static let storyboardName = "{{storyboard.name}}" + {{accessModifier}} enum {{storyboardName}}: StoryboardType { + {{accessModifier}} static let storyboardName = "{{storyboard.name}}" {% if storyboard.initialScene %} {% set sceneClass %}{% call className storyboard.initialScene %}{% endset %} - static let initialScene = InitialSceneType<{{sceneClass}}>({{storyboardName}}.self) + {{accessModifier}} static let initialScene = InitialSceneType<{{sceneClass}}>({{storyboardName}}.self) {% endif %} {% for scene in storyboard.scenes %} {% set sceneID %}{{scene.identifier|swiftIdentifier:"pretty"|escapeReservedKeywords}}{% endset %} {% set sceneClass %}{% call className scene %}{% endset %} - static let {{sceneID}} = SceneType<{{sceneClass}}>({{storyboardName}}.self, identifier: "{{scene.identifier}}") + {{accessModifier}} static let {{sceneID}} = SceneType<{{sceneClass}}>({{storyboardName}}.self, identifier: "{{scene.identifier}}") {% endfor %} } {% endfor %} } -enum {{param.segueEnumName|default:"StoryboardSegue"}} { +{{accessModifier}} enum {{param.segueEnumName|default:"StoryboardSegue"}} { {% for storyboard in storyboards where storyboard.segues %} - enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { + {{accessModifier}} enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { {% for segue in storyboard.segues %} {% set segueID %}{{segue.identifier|swiftIdentifier:"pretty"}}{% endset %} case {{segueID|escapeReservedKeywords}}{% if segueID != segue.identifier %} = "{{segue.identifier}}"{% endif %} diff --git a/templates/storyboards/swift3.stencil b/templates/storyboards/swift3.stencil index f6ddf90..4faeb39 100644 --- a/templates/storyboards/swift3.stencil +++ b/templates/storyboards/swift3.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} @@ -15,21 +16,21 @@ import {{module}} // swiftlint:disable file_length {# This first part of the code is static, same every time whatever Storyboard you have #} -protocol StoryboardType { +{{accessModifier}} protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +{{accessModifier}} extension StoryboardType { static var storyboard: {{prefix}}Storyboard { return {{prefix}}Storyboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +{{accessModifier}} struct SceneType { + {{accessModifier}} let storyboard: StoryboardType.Type + {{accessModifier}} let identifier: String - func instantiate() -> T { + {{accessModifier}} func instantiate() -> T { guard let controller = storyboard.storyboard.instantiate{{controller}}(withIdentifier: identifier) as? T else { fatalError("{{controller}} '\(identifier)' is not of the expected class \(T.self).") } @@ -37,10 +38,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +{{accessModifier}} struct InitialSceneType { + {{accessModifier}} let storyboard: StoryboardType.Type - func instantiate() -> T { + {{accessModifier}} func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitial{{controller}}() as? T else { fatalError("{{controller}} is not of the expected class \(T.self).") } @@ -48,9 +49,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +{{accessModifier}} protocol SegueType: RawRepresentable { } -extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { +{{accessModifier}} extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { performSegue{% if isAppKit %}?{% endif %}(withIdentifier: segue.rawValue, sender: sender) } @@ -71,29 +72,29 @@ extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif % {{prefix}}{{scene.baseType}} {% endif %} {% endfilter %}{% endmacro %} -enum {{sceneEnumName}} { +{{accessModifier}} enum {{sceneEnumName}} { {% for storyboard in storyboards %} {% set storyboardName %}{{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}{% endset %} - enum {{storyboardName}}: StoryboardType { - static let storyboardName = "{{storyboard.name}}" + {{accessModifier}} enum {{storyboardName}}: StoryboardType { + {{accessModifier}} static let storyboardName = "{{storyboard.name}}" {% if storyboard.initialScene %} {% set sceneClass %}{% call className storyboard.initialScene %}{% endset %} - static let initialScene = InitialSceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self) + {{accessModifier}} static let initialScene = InitialSceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self) {% endif %} {% for scene in storyboard.scenes %} {% set sceneID %}{{scene.identifier|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}{% endset %} {% set sceneClass %}{% call className scene %}{% endset %} - static let {{sceneID}} = SceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self, identifier: "{{scene.identifier}}") + {{accessModifier}} static let {{sceneID}} = SceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self, identifier: "{{scene.identifier}}") {% endfor %} } {% endfor %} } -enum {{param.segueEnumName|default:"StoryboardSegue"}} { +{{accessModifier}} enum {{param.segueEnumName|default:"StoryboardSegue"}} { {% for storyboard in storyboards where storyboard.segues %} - enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { + {{accessModifier}} enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { {% for segue in storyboard.segues %} {% set segueID %}{{segue.identifier|swiftIdentifier:"pretty"|lowerFirstWord}}{% endset %} case {{segueID|escapeReservedKeywords}}{% if segueID != segue.identifier %} = "{{segue.identifier}}"{% endif %} diff --git a/templates/storyboards/swift4.stencil b/templates/storyboards/swift4.stencil index f802314..732663a 100644 --- a/templates/storyboards/swift4.stencil +++ b/templates/storyboards/swift4.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} @@ -15,22 +16,22 @@ import {{module}} // swiftlint:disable file_length {# This first part of the code is static, same every time whatever Storyboard you have #} -protocol StoryboardType { +{{accessModifier}} protocol StoryboardType { static var storyboardName: String { get } } -extension StoryboardType { +{{accessModifier}} extension StoryboardType { static var storyboard: {{prefix}}Storyboard { let name = {% if isAppKit %}NSStoryboard.Name({% endif %}self.storyboardName{% if isAppKit %}){% endif %} return {{prefix}}Storyboard(name: name, bundle: Bundle(for: BundleToken.self)) } } -struct SceneType { - let storyboard: StoryboardType.Type - let identifier: String +{{accessModifier}} struct SceneType { + {{accessModifier}} let storyboard: StoryboardType.Type + {{accessModifier}} let identifier: String - func instantiate() -> T { + {{accessModifier}} func instantiate() -> T { let identifier = {% if isAppKit %}NSStoryboard.SceneIdentifier({% endif %}self.identifier{% if isAppKit %}){% endif %} guard let controller = storyboard.storyboard.instantiate{{controller}}(withIdentifier: identifier) as? T else { fatalError("{{controller}} '\(identifier)' is not of the expected class \(T.self).") @@ -39,10 +40,10 @@ struct SceneType { } } -struct InitialSceneType { - let storyboard: StoryboardType.Type +{{accessModifier}} struct InitialSceneType { + {{accessModifier}} let storyboard: StoryboardType.Type - func instantiate() -> T { + {{accessModifier}} func instantiate() -> T { guard let controller = storyboard.storyboard.instantiateInitial{{controller}}() as? T else { fatalError("{{controller}} is not of the expected class \(T.self).") } @@ -50,9 +51,9 @@ struct InitialSceneType { } } -protocol SegueType: RawRepresentable { } +{{accessModifier}} protocol SegueType: RawRepresentable { } -extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { +{{accessModifier}} extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif %} { func perform(segue: S, sender: Any? = nil) where S.RawValue == String { let identifier = {% if isAppKit %}NSStoryboardSegue.Identifier({% endif %}segue.rawValue{% if isAppKit %}){% endif %} performSegue{% if isAppKit %}?{% endif %}(withIdentifier: identifier, sender: sender) @@ -74,29 +75,29 @@ extension {% if isAppKit %}NSSeguePerforming{% else %}UIViewController{% endif % {{prefix}}{{scene.baseType}} {% endif %} {% endfilter %}{% endmacro %} -enum {{sceneEnumName}} { +{{accessModifier}} enum {{sceneEnumName}} { {% for storyboard in storyboards %} {% set storyboardName %}{{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}{% endset %} - enum {{storyboardName}}: StoryboardType { - static let storyboardName = "{{storyboard.name}}" + {{accessModifier}} enum {{storyboardName}}: StoryboardType { + {{accessModifier}} static let storyboardName = "{{storyboard.name}}" {% if storyboard.initialScene %} {% set sceneClass %}{% call className storyboard.initialScene %}{% endset %} - static let initialScene = InitialSceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self) + {{accessModifier}} static let initialScene = InitialSceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self) {% endif %} {% for scene in storyboard.scenes %} {% set sceneID %}{{scene.identifier|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}{% endset %} {% set sceneClass %}{% call className scene %}{% endset %} - static let {{sceneID}} = SceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self, identifier: "{{scene.identifier}}") + {{accessModifier}} static let {{sceneID}} = SceneType<{{sceneClass}}>(storyboard: {{storyboardName}}.self, identifier: "{{scene.identifier}}") {% endfor %} } {% endfor %} } -enum {{param.segueEnumName|default:"StoryboardSegue"}} { +{{accessModifier}} enum {{param.segueEnumName|default:"StoryboardSegue"}} { {% for storyboard in storyboards where storyboard.segues %} - enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { + {{accessModifier}} enum {{storyboard.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}: String, SegueType { {% for segue in storyboard.segues %} {% set segueID %}{{segue.identifier|swiftIdentifier:"pretty"|lowerFirstWord}}{% endset %} case {{segueID|escapeReservedKeywords}}{% if segueID != segue.identifier %} = "{{segue.identifier}}"{% endif %} diff --git a/templates/strings/flat-swift2.stencil b/templates/strings/flat-swift2.stencil index 5df2cec..65a6306 100644 --- a/templates/strings/flat-swift2.stencil +++ b/templates/strings/flat-swift2.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,11 +22,11 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.key|swiftIdentifier:"pretty"|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.key|swiftIdentifier:"pretty"|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.key|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.key|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} @@ -35,10 +36,10 @@ import Foundation // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/strings/flat-swift3.stencil b/templates/strings/flat-swift3.stencil index 455a2e8..707465b 100644 --- a/templates/strings/flat-swift3.stencil +++ b/templates/strings/flat-swift3.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,11 +22,11 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} @@ -35,10 +36,10 @@ import Foundation // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/strings/flat-swift4.stencil b/templates/strings/flat-swift4.stencil index e9c7458..64896bc 100644 --- a/templates/strings/flat-swift4.stencil +++ b/templates/strings/flat-swift4.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,11 +22,11 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} @@ -35,10 +36,10 @@ import Foundation // swiftlint:disable identifier_name line_length type_body_length {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/strings/structured-swift2.stencil b/templates/strings/structured-swift2.stencil index 872ad28..6924a51 100644 --- a/templates/strings/structured-swift2.stencil +++ b/templates/strings/structured-swift2.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,16 +22,16 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} -{{sp}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call recursiveBlock table child sp2 %} {{sp}} } @@ -39,10 +40,10 @@ import Foundation // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/strings/structured-swift3.stencil b/templates/strings/structured-swift3.stencil index 658e33b..4a547d0 100644 --- a/templates/strings/structured-swift3.stencil +++ b/templates/strings/structured-swift3.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,16 +22,16 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} -{{sp}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call recursiveBlock table child sp2 %} {{sp}} } @@ -39,10 +40,10 @@ import Foundation // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/strings/structured-swift4.stencil b/templates/strings/structured-swift4.stencil index 2d8a571..92a31c6 100644 --- a/templates/strings/structured-swift4.stencil +++ b/templates/strings/structured-swift4.stencil @@ -1,6 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command @@ -21,16 +22,16 @@ import Foundation {{sp}} /// {{string.translation}} {{sp}} {% endif %} {{sp}} {% if string.types %} -{{sp}} static func {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { +{{sp}} {{accessModifier}} static func {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}({% call parametersBlock string.types %}) -> String { {{sp}} return {{enumName}}.tr("{{table}}", "{{string.key}}", {% call argumentsBlock string.types %}) {{sp}} } {{sp}} {% else %} -{{sp}} static let {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") +{{sp}} {{accessModifier}} static let {{string.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{enumName}}.tr("{{table}}", "{{string.key}}") {{sp}} {% endif %} {{sp}} {% endfor %} {{sp}} {% for child in item.children %} -{{sp}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{child.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call recursiveBlock table child sp2 %} {{sp}} } @@ -39,10 +40,10 @@ import Foundation // swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name {% set enumName %}{{param.enumName|default:"L10n"}}{% endset %} -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if tables.count > 1 %} {% for table in tables %} - enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{table.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call recursiveBlock table.name table.levels " " %} } {% endfor %} diff --git a/templates/xcassets/swift2.stencil b/templates/xcassets/swift2.stencil index 1f463a1..630a422 100644 --- a/templates/xcassets/swift2.stencil +++ b/templates/xcassets/swift2.stencil @@ -2,12 +2,13 @@ {% if catalogs %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage - typealias {{imageAlias}} = NSImage + {{accessModifier}} typealias {{imageAlias}} = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias {{imageAlias}} = UIImage + {{accessModifier}} typealias {{imageAlias}} = UIImage #endif // swiftlint:disable superfluous_disable_command @@ -16,12 +17,12 @@ {% set enumName %}{{param.enumName|default:"Asset"}}{% endset %} {% set imageType %}{{param.imageTypeName|default:"ImageAsset"}}{% endset %} @available(*, deprecated, renamed: "{{imageType}}") -typealias {{enumName}}Type = {{imageType}} +{{accessModifier}} typealias {{enumName}}Type = {{imageType}} -struct {{imageType}} { - private(set) var name: String +{{accessModifier}} struct {{imageType}} { + {{accessModifier}} private(set) var name: String - var image: {{imageAlias}} { + {{accessModifier}} var image: {{imageAlias}} { let bundle = NSBundle(forClass: BundleToken.self) #if os(iOS) || os(tvOS) let image = {{imageAlias}}(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) @@ -36,35 +37,35 @@ struct {{imageType}} { } {% set colorType %}{{param.colorTypeName|default:"ColorAsset"}}{% endset %} -struct {{colorType}} { - fileprivate(set) var name: String +{{accessModifier}} struct {{colorType}} { + {{accessModifier}} fileprivate(set) var name: String } {% macro enumBlock assets sp %} {{sp}} {% call casesBlock assets sp %} {{sp}} {% if not param.noAllValues %} {{sp}} // swiftlint:disable trailing_comma -{{sp}} static let allColors: [{{colorType}}] = [ +{{sp}} {{accessModifier}} static let allColors: [{{colorType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "color" "" sp2 %} {{sp}} ] -{{sp}} static let allImages: [{{imageType}}] = [ +{{sp}} {{accessModifier}} static let allImages: [{{imageType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "image" "" sp2 %} {{sp}} ] {{sp}} // swiftlint:enable trailing_comma {{sp}} @available(*, deprecated, renamed: "allImages") -{{sp}} static let allValues: [{{enumName}}Type] = allImages +{{sp}} {{accessModifier}} static let allValues: [{{enumName}}Type] = allImages {{sp}} {% endif %} {% endmacro %} {% macro casesBlock assets sp %} {{sp}} {% for asset in assets %} {{sp}} {% if asset.type == "color" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") {{sp}} {% elif asset.type == "image" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") {{sp}} {% elif asset.items %} -{{sp}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call casesBlock asset.items sp2 %} {{sp}} } @@ -83,10 +84,10 @@ struct {{colorType}} { {% endmacro %} // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if catalogs.count > 1 %} {% for catalog in catalogs %} - enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock catalog.assets " " %} } {% endfor %} @@ -96,7 +97,7 @@ enum {{enumName}} { } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension {{imageAlias}} { +{{accessModifier}} extension {{imageAlias}} { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the {{imageType}}.image property") diff --git a/templates/xcassets/swift3.stencil b/templates/xcassets/swift3.stencil index f918a2b..9795b32 100644 --- a/templates/xcassets/swift3.stencil +++ b/templates/xcassets/swift3.stencil @@ -3,14 +3,15 @@ {% if catalogs %} {% set colorAlias %}{{param.colorAliasName|default:"AssetColorTypeAlias"}}{% endset %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage - typealias {{colorAlias}} = NSColor - typealias {{imageAlias}} = NSImage + {{accessModifier}} typealias {{colorAlias}} = NSColor + {{accessModifier}} typealias {{imageAlias}} = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias {{colorAlias}} = UIColor - typealias {{imageAlias}} = UIImage + {{accessModifier}} typealias {{colorAlias}} = UIColor + {{accessModifier}} typealias {{imageAlias}} = UIImage #endif // swiftlint:disable superfluous_disable_command @@ -19,12 +20,12 @@ {% set enumName %}{{param.enumName|default:"Asset"}}{% endset %} {% set imageType %}{{param.imageTypeName|default:"ImageAsset"}}{% endset %} @available(*, deprecated, renamed: "{{imageType}}") -typealias {{enumName}}Type = {{imageType}} +{{accessModifier}} typealias {{enumName}}Type = {{imageType}} -struct {{imageType}} { - fileprivate(set) var name: String +{{accessModifier}} struct {{imageType}} { + {{accessModifier}} fileprivate(set) var name: String - var image: {{imageAlias}} { + {{accessModifier}} var image: {{imageAlias}} { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = {{imageAlias}}(named: name, in: bundle, compatibleWith: nil) @@ -39,12 +40,12 @@ struct {{imageType}} { } {% set colorType %}{{param.colorTypeName|default:"ColorAsset"}}{% endset %} -struct {{colorType}} { - fileprivate(set) var name: String +{{accessModifier}} struct {{colorType}} { + {{accessModifier}} fileprivate(set) var name: String #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: {{colorAlias}} { + {{accessModifier}} var color: {{colorAlias}} { return {{colorAlias}}(asset: self) } #endif @@ -54,27 +55,27 @@ struct {{colorType}} { {{sp}} {% if not param.noAllValues %} {{sp}} // swiftlint:disable trailing_comma -{{sp}} static let allColors: [{{colorType}}] = [ +{{sp}} {{accessModifier}} static let allColors: [{{colorType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "color" "" sp2 %} {{sp}} ] -{{sp}} static let allImages: [{{imageType}}] = [ +{{sp}} {{accessModifier}} static let allImages: [{{imageType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "image" "" sp2 %} {{sp}} ] {{sp}} // swiftlint:enable trailing_comma {{sp}} @available(*, deprecated, renamed: "allImages") -{{sp}} static let allValues: [{{enumName}}Type] = allImages +{{sp}} {{accessModifier}} static let allValues: [{{enumName}}Type] = allImages {{sp}} {% endif %} {% endmacro %} {% macro casesBlock assets sp %} {{sp}} {% for asset in assets %} {{sp}} {% if asset.type == "color" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") {{sp}} {% elif asset.type == "image" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") {{sp}} {% elif asset.items %} -{{sp}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call casesBlock asset.items sp2 %} {{sp}} } @@ -93,10 +94,10 @@ struct {{colorType}} { {% endmacro %} // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if catalogs.count > 1 %} {% for catalog in catalogs %} - enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock catalog.assets " " %} } {% endfor %} @@ -106,7 +107,7 @@ enum {{enumName}} { } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension {{imageAlias}} { +{{accessModifier}} extension {{imageAlias}} { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the {{imageType}}.image property") @@ -120,7 +121,7 @@ extension {{imageAlias}} { } } -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { #if swift(>=3.2) @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: {{colorType}}) { diff --git a/templates/xcassets/swift4.stencil b/templates/xcassets/swift4.stencil index 89f35c5..fba0e16 100644 --- a/templates/xcassets/swift4.stencil +++ b/templates/xcassets/swift4.stencil @@ -3,14 +3,15 @@ {% if catalogs %} {% set colorAlias %}{{param.colorAliasName|default:"AssetColorTypeAlias"}}{% endset %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} +{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage - typealias {{colorAlias}} = NSColor - typealias {{imageAlias}} = NSImage + {{accessModifier}} typealias {{colorAlias}} = NSColor + {{accessModifier}} typealias {{imageAlias}} = NSImage #elseif os(iOS) || os(tvOS) || os(watchOS) import UIKit.UIImage - typealias {{colorAlias}} = UIColor - typealias {{imageAlias}} = UIImage + {{accessModifier}} typealias {{colorAlias}} = UIColor + {{accessModifier}} typealias {{imageAlias}} = UIImage #endif // swiftlint:disable superfluous_disable_command @@ -19,12 +20,12 @@ {% set enumName %}{{param.enumName|default:"Asset"}}{% endset %} {% set imageType %}{{param.imageTypeName|default:"ImageAsset"}}{% endset %} @available(*, deprecated, renamed: "{{imageType}}") -typealias {{enumName}}Type = {{imageType}} +{{accessModifier}} typealias {{enumName}}Type = {{imageType}} -struct {{imageType}} { - fileprivate(set) var name: String +{{accessModifier}} struct {{imageType}} { + {{accessModifier}} fileprivate(set) var name: String - var image: {{imageAlias}} { + {{accessModifier}} var image: {{imageAlias}} { let bundle = Bundle(for: BundleToken.self) #if os(iOS) || os(tvOS) let image = {{imageAlias}}(named: name, in: bundle, compatibleWith: nil) @@ -39,11 +40,11 @@ struct {{imageType}} { } {% set colorType %}{{param.colorTypeName|default:"ColorAsset"}}{% endset %} -struct {{colorType}} { - fileprivate(set) var name: String +{{accessModifier}} struct {{colorType}} { + {{accessModifier}} fileprivate(set) var name: String @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - var color: {{colorAlias}} { + {{accessModifier}} var color: {{colorAlias}} { return {{colorAlias}}(asset: self) } } @@ -52,27 +53,27 @@ struct {{colorType}} { {{sp}} {% if not param.noAllValues %} {{sp}} // swiftlint:disable trailing_comma -{{sp}} static let allColors: [{{colorType}}] = [ +{{sp}} {{accessModifier}} static let allColors: [{{colorType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "color" "" sp2 %} {{sp}} ] -{{sp}} static let allImages: [{{imageType}}] = [ +{{sp}} {{accessModifier}} static let allImages: [{{imageType}}] = [ {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call allValuesBlock assets "image" "" sp2 %} {{sp}} ] {{sp}} // swiftlint:enable trailing_comma {{sp}} @available(*, deprecated, renamed: "allImages") -{{sp}} static let allValues: [{{enumName}}Type] = allImages +{{sp}} {{accessModifier}} static let allValues: [{{enumName}}Type] = allImages {{sp}} {% endif %} {% endmacro %} {% macro casesBlock assets sp %} {{sp}} {% for asset in assets %} {{sp}} {% if asset.type == "color" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") {{sp}} {% elif asset.type == "image" %} -{{sp}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") +{{sp}} {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") {{sp}} {% elif asset.items %} -{{sp}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { +{{sp}} {{accessModifier}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {{sp}} {% set sp2 %}{{sp}} {% endset %} {{sp}} {% call casesBlock asset.items sp2 %} {{sp}} } @@ -91,10 +92,10 @@ struct {{colorType}} { {% endmacro %} // swiftlint:disable identifier_name line_length nesting type_body_length type_name -enum {{enumName}} { +{{accessModifier}} enum {{enumName}} { {% if catalogs.count > 1 %} {% for catalog in catalogs %} - enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {{accessModifier}} enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { {% call enumBlock catalog.assets " " %} } {% endfor %} @@ -104,7 +105,7 @@ enum {{enumName}} { } // swiftlint:enable identifier_name line_length nesting type_body_length type_name -extension {{imageAlias}} { +{{accessModifier}} extension {{imageAlias}} { @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) @available(OSX, deprecated, message: "This initializer is unsafe on macOS, please use the {{imageType}}.image property") @@ -120,7 +121,7 @@ extension {{imageAlias}} { } } -extension {{colorAlias}} { +{{accessModifier}} extension {{colorAlias}} { @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) convenience init!(asset: {{colorType}}) { let bundle = Bundle(for: BundleToken.self) From 9be7dc61f0648da7da31cd83e5492d8f47a501dd Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Sun, 22 Oct 2017 13:59:13 +0200 Subject: [PATCH 2/8] Update documentation --- Documentation/colors/literals-swift3.md | 1 + Documentation/colors/literals-swift4.md | 1 + Documentation/colors/swift2.md | 1 + Documentation/colors/swift3.md | 1 + Documentation/colors/swift4.md | 1 + Documentation/fonts/swift2.md | 1 + Documentation/fonts/swift3.md | 1 + Documentation/fonts/swift4.md | 1 + Documentation/storyboards/swift2.md | 1 + Documentation/storyboards/swift3.md | 1 + Documentation/storyboards/swift4.md | 1 + Documentation/strings/flat-swift2.md | 1 + Documentation/strings/flat-swift3.md | 1 + Documentation/strings/flat-swift4.md | 1 + Documentation/strings/structured-swift2.md | 1 + Documentation/strings/structured-swift3.md | 1 + Documentation/strings/structured-swift4.md | 1 + Documentation/xcassets/swift2.md | 1 + Documentation/xcassets/swift3.md | 1 + Documentation/xcassets/swift4.md | 1 + 20 files changed, 20 insertions(+) diff --git a/Documentation/colors/literals-swift3.md b/Documentation/colors/literals-swift3.md index 175a8ab..61118e8 100644 --- a/Documentation/colors/literals-swift3.md +++ b/Documentation/colors/literals-swift3.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | Parameter Name | Default Value | Description | | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | Note: if you use `--param enumName=UIColor` (or `NSColor` on macOS) then the color constants will be generated as an extension of the `UIColor` (iOS) / `NSColor` (macOS) type directly without creating a separate `enum` type for namespacing those color constants. diff --git a/Documentation/colors/literals-swift4.md b/Documentation/colors/literals-swift4.md index 38dab50..1cb469b 100644 --- a/Documentation/colors/literals-swift4.md +++ b/Documentation/colors/literals-swift4.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | Parameter Name | Default Value | Description | | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | Note: if you use `--param enumName=UIColor` (or `NSColor` on macOS) then the color constants will be generated as an extension of the `UIColor` (iOS) / `NSColor` (macOS) type directly without creating a separate `enum` type for namespacing those color constants. diff --git a/Documentation/colors/swift2.md b/Documentation/colors/swift2.md index 7fd0ced..fdb6d78 100644 --- a/Documentation/colors/swift2.md +++ b/Documentation/colors/swift2.md @@ -21,6 +21,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/colors/swift3.md b/Documentation/colors/swift3.md index 193c89c..7d66f03 100644 --- a/Documentation/colors/swift3.md +++ b/Documentation/colors/swift3.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/colors/swift4.md b/Documentation/colors/swift4.md index fd3c08c..2262a9a 100644 --- a/Documentation/colors/swift4.md +++ b/Documentation/colors/swift4.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift2.md b/Documentation/fonts/swift2.md index e915d94..ccd4e88 100644 --- a/Documentation/fonts/swift2.md +++ b/Documentation/fonts/swift2.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift3.md b/Documentation/fonts/swift3.md index bb4fb8d..bf453ad 100644 --- a/Documentation/fonts/swift3.md +++ b/Documentation/fonts/swift3.md @@ -19,6 +19,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift4.md b/Documentation/fonts/swift4.md index 7756c54..cc49a44 100644 --- a/Documentation/fonts/swift4.md +++ b/Documentation/fonts/swift4.md @@ -19,6 +19,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift2.md b/Documentation/storyboards/swift2.md index 041fd69..53b1804 100644 --- a/Documentation/storyboards/swift2.md +++ b/Documentation/storyboards/swift2.md @@ -23,6 +23,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift3.md b/Documentation/storyboards/swift3.md index a359820..dcb584e 100644 --- a/Documentation/storyboards/swift3.md +++ b/Documentation/storyboards/swift3.md @@ -22,6 +22,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift4.md b/Documentation/storyboards/swift4.md index 435154d..93b44fe 100644 --- a/Documentation/storyboards/swift4.md +++ b/Documentation/storyboards/swift4.md @@ -22,6 +22,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift2.md b/Documentation/strings/flat-swift2.md index b1f8ed2..8b06156 100644 --- a/Documentation/strings/flat-swift2.md +++ b/Documentation/strings/flat-swift2.md @@ -21,6 +21,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift3.md b/Documentation/strings/flat-swift3.md index 93f7843..f6298ff 100644 --- a/Documentation/strings/flat-swift3.md +++ b/Documentation/strings/flat-swift3.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift4.md b/Documentation/strings/flat-swift4.md index 7c2f4a8..b4d10c1 100644 --- a/Documentation/strings/flat-swift4.md +++ b/Documentation/strings/flat-swift4.md @@ -20,6 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift2.md b/Documentation/strings/structured-swift2.md index fe258f4..d52f656 100644 --- a/Documentation/strings/structured-swift2.md +++ b/Documentation/strings/structured-swift2.md @@ -27,6 +27,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift3.md b/Documentation/strings/structured-swift3.md index 0f24609..e5de7b0 100644 --- a/Documentation/strings/structured-swift3.md +++ b/Documentation/strings/structured-swift3.md @@ -26,6 +26,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift4.md b/Documentation/strings/structured-swift4.md index 6ecf0d0..99a8dac 100644 --- a/Documentation/strings/structured-swift4.md +++ b/Documentation/strings/structured-swift4.md @@ -26,6 +26,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift2.md b/Documentation/xcassets/swift2.md index 8f2848c..d0b1ced 100644 --- a/Documentation/xcassets/swift2.md +++ b/Documentation/xcassets/swift2.md @@ -25,6 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift3.md b/Documentation/xcassets/swift3.md index 26273e6..723d4c9 100644 --- a/Documentation/xcassets/swift3.md +++ b/Documentation/xcassets/swift3.md @@ -25,6 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift4.md b/Documentation/xcassets/swift4.md index 9647dbc..23db004 100644 --- a/Documentation/xcassets/swift4.md +++ b/Documentation/xcassets/swift4.md @@ -25,6 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | +| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code From d474550de0398e81f6cf2d85b6858d9ce08d43b6 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Sun, 22 Oct 2017 14:06:38 +0200 Subject: [PATCH 3/8] CHANGELOG entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index efacefc..a107340 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ _None_ * XCAssets: exposed getter for color name string. [Stephan Diederich](https://github.com/diederich) [#87](https://github.com/SwiftGen/templates/pull/87) +* Allows to set all properties as `public` by using `--param public` on all templates. + [Olivier Halligon](https://github.com/AliSoftware) + [#84](https://github.com/SwiftGen/templates/pull/84) + [Txai Wieser](https://github.com/txaiwieser) + [#81](https://github.com/SwiftGen/templates/pull/81) ### Internal Changes From 55c47eb40cb7834eca7b2fbd961c341012c607de Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Sun, 22 Oct 2017 15:14:18 +0200 Subject: [PATCH 4/8] Renamed the param from "public" to "publicAccess" --- CHANGELOG.md | 2 +- Documentation/colors/literals-swift3.md | 2 +- Documentation/colors/literals-swift4.md | 2 +- Documentation/colors/swift2.md | 2 +- Documentation/colors/swift3.md | 2 +- Documentation/colors/swift4.md | 2 +- Documentation/fonts/swift2.md | 2 +- Documentation/fonts/swift3.md | 2 +- Documentation/fonts/swift4.md | 2 +- Documentation/storyboards/swift2.md | 2 +- Documentation/storyboards/swift3.md | 2 +- Documentation/storyboards/swift4.md | 2 +- Documentation/strings/flat-swift2.md | 2 +- Documentation/strings/flat-swift3.md | 2 +- Documentation/strings/flat-swift4.md | 2 +- Documentation/strings/structured-swift2.md | 2 +- Documentation/strings/structured-swift3.md | 2 +- Documentation/strings/structured-swift4.md | 2 +- Documentation/xcassets/swift2.md | 2 +- Documentation/xcassets/swift3.md | 2 +- Documentation/xcassets/swift4.md | 2 +- templates/colors/literals-swift3.stencil | 2 +- templates/colors/literals-swift4.stencil | 2 +- templates/colors/swift2.stencil | 2 +- templates/colors/swift3.stencil | 2 +- templates/colors/swift4.stencil | 2 +- templates/fonts/swift2.stencil | 2 +- templates/fonts/swift3.stencil | 2 +- templates/fonts/swift4.stencil | 2 +- templates/storyboards/swift2.stencil | 2 +- templates/storyboards/swift3.stencil | 2 +- templates/storyboards/swift4.stencil | 2 +- templates/strings/flat-swift2.stencil | 2 +- templates/strings/flat-swift3.stencil | 2 +- templates/strings/flat-swift4.stencil | 2 +- templates/strings/structured-swift2.stencil | 2 +- templates/strings/structured-swift3.stencil | 2 +- templates/strings/structured-swift4.stencil | 2 +- templates/xcassets/swift2.stencil | 2 +- templates/xcassets/swift3.stencil | 2 +- templates/xcassets/swift4.stencil | 2 +- 41 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a107340..ca35f5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ _None_ * XCAssets: exposed getter for color name string. [Stephan Diederich](https://github.com/diederich) [#87](https://github.com/SwiftGen/templates/pull/87) -* Allows to set all properties as `public` by using `--param public` on all templates. +* Allows to set all properties as `public` by using `--param publicAccess` on all templates. [Olivier Halligon](https://github.com/AliSoftware) [#84](https://github.com/SwiftGen/templates/pull/84) [Txai Wieser](https://github.com/txaiwieser) diff --git a/Documentation/colors/literals-swift3.md b/Documentation/colors/literals-swift3.md index 61118e8..f7d090d 100644 --- a/Documentation/colors/literals-swift3.md +++ b/Documentation/colors/literals-swift3.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | Parameter Name | Default Value | Description | | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | Note: if you use `--param enumName=UIColor` (or `NSColor` on macOS) then the color constants will be generated as an extension of the `UIColor` (iOS) / `NSColor` (macOS) type directly without creating a separate `enum` type for namespacing those color constants. diff --git a/Documentation/colors/literals-swift4.md b/Documentation/colors/literals-swift4.md index 1cb469b..c2682f1 100644 --- a/Documentation/colors/literals-swift4.md +++ b/Documentation/colors/literals-swift4.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | Parameter Name | Default Value | Description | | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | Note: if you use `--param enumName=UIColor` (or `NSColor` on macOS) then the color constants will be generated as an extension of the `UIColor` (iOS) / `NSColor` (macOS) type directly without creating a separate `enum` type for namespacing those color constants. diff --git a/Documentation/colors/swift2.md b/Documentation/colors/swift2.md index fdb6d78..177f5f1 100644 --- a/Documentation/colors/swift2.md +++ b/Documentation/colors/swift2.md @@ -21,7 +21,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/colors/swift3.md b/Documentation/colors/swift3.md index 7d66f03..a8de1ae 100644 --- a/Documentation/colors/swift3.md +++ b/Documentation/colors/swift3.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/colors/swift4.md b/Documentation/colors/swift4.md index 2262a9a..6cccf90 100644 --- a/Documentation/colors/swift4.md +++ b/Documentation/colors/swift4.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `ColorName` | Allows you to change the name of the generated `enum` containing all colors. | | `colorAliasName` | `Color` | Allows you to change the name of the generated `typealias` for the platform specific color type. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift2.md b/Documentation/fonts/swift2.md index ccd4e88..1d90ebd 100644 --- a/Documentation/fonts/swift2.md +++ b/Documentation/fonts/swift2.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift3.md b/Documentation/fonts/swift3.md index bf453ad..4aa2f99 100644 --- a/Documentation/fonts/swift3.md +++ b/Documentation/fonts/swift3.md @@ -19,7 +19,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/fonts/swift4.md b/Documentation/fonts/swift4.md index cc49a44..84b649e 100644 --- a/Documentation/fonts/swift4.md +++ b/Documentation/fonts/swift4.md @@ -19,7 +19,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `FontFamily` | Allows you to change the name of the generated `enum` containing all font families. | | `preservePath` | N/A | Setting this parameter will disable the basename filter applied to all font paths. Use this if you added your font folder as a "folder reference" in your Xcode project, making that folder hierarchy preserved once copied in the build app bundle. The path will be relative to the folder you provided to SwiftGen. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift2.md b/Documentation/storyboards/swift2.md index 53b1804..11a7f3f 100644 --- a/Documentation/storyboards/swift2.md +++ b/Documentation/storyboards/swift2.md @@ -23,7 +23,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift3.md b/Documentation/storyboards/swift3.md index dcb584e..c817f25 100644 --- a/Documentation/storyboards/swift3.md +++ b/Documentation/storyboards/swift3.md @@ -22,7 +22,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/storyboards/swift4.md b/Documentation/storyboards/swift4.md index 93b44fe..ccf62a5 100644 --- a/Documentation/storyboards/swift4.md +++ b/Documentation/storyboards/swift4.md @@ -22,7 +22,7 @@ You can customize some elements of this template by overriding the following par | `segueEnumName` | `StoryboardSegue` | Allows you to change the name of the generated `enum` containing all storyboard segues. | | `module` | N/A | By default, the template will import the needed modules for custom classes, but won’t import the target’s module to avoid an import warning — using the `PRODUCT_MODULE_NAME` environment variable to detect it. Should you need to ignore an additional module, you can provide it here. | | `ignoreTargetModule` | N/A | Setting this parameter will disable the behaviour of prefixing classes with their module name for (only) the target module. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift2.md b/Documentation/strings/flat-swift2.md index 8b06156..214813a 100644 --- a/Documentation/strings/flat-swift2.md +++ b/Documentation/strings/flat-swift2.md @@ -21,7 +21,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift3.md b/Documentation/strings/flat-swift3.md index f6298ff..7d38bd9 100644 --- a/Documentation/strings/flat-swift3.md +++ b/Documentation/strings/flat-swift3.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/flat-swift4.md b/Documentation/strings/flat-swift4.md index b4d10c1..e63ffd0 100644 --- a/Documentation/strings/flat-swift4.md +++ b/Documentation/strings/flat-swift4.md @@ -20,7 +20,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift2.md b/Documentation/strings/structured-swift2.md index d52f656..01b1b6d 100644 --- a/Documentation/strings/structured-swift2.md +++ b/Documentation/strings/structured-swift2.md @@ -27,7 +27,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift3.md b/Documentation/strings/structured-swift3.md index e5de7b0..e8b8da9 100644 --- a/Documentation/strings/structured-swift3.md +++ b/Documentation/strings/structured-swift3.md @@ -26,7 +26,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/strings/structured-swift4.md b/Documentation/strings/structured-swift4.md index 99a8dac..b4cf923 100644 --- a/Documentation/strings/structured-swift4.md +++ b/Documentation/strings/structured-swift4.md @@ -26,7 +26,7 @@ You can customize some elements of this template by overriding the following par | -------------- | ------------- | ----------- | | `enumName` | `L10n` | Allows you to change the name of the generated `enum` containing all string tables. | | `noComments` | N/A | Setting this parameter will disable the comments describing the translation of a key. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift2.md b/Documentation/xcassets/swift2.md index d0b1ced..17f0842 100644 --- a/Documentation/xcassets/swift2.md +++ b/Documentation/xcassets/swift2.md @@ -25,7 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift3.md b/Documentation/xcassets/swift3.md index 723d4c9..00e3597 100644 --- a/Documentation/xcassets/swift3.md +++ b/Documentation/xcassets/swift3.md @@ -25,7 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/Documentation/xcassets/swift4.md b/Documentation/xcassets/swift4.md index 23db004..1de4d15 100644 --- a/Documentation/xcassets/swift4.md +++ b/Documentation/xcassets/swift4.md @@ -25,7 +25,7 @@ You can customize some elements of this template by overriding the following par | `colorTypeName` | `ColorAsset` | Allows you to change the name of the struct type representing a color. | | `imageTypeName` | `ImageAsset` | Allows you to change the name of the struct type representing an image. | | `noAllValues` | N/A | Setting this parameter will disable generation of the `allColors` and `allImages` constants. | -| `public` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | +| `publicAccess` | N/A | If set, the generated constants will be marked as `public`. Otherwise, they'll be declared `internal`. | ## Generated Code diff --git a/templates/colors/literals-swift3.stencil b/templates/colors/literals-swift3.stencil index bc9696c..3409831 100644 --- a/templates/colors/literals-swift3.stencil +++ b/templates/colors/literals-swift3.stencil @@ -2,7 +2,7 @@ {% if palettes %} {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit {% if enumName != 'NSColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} diff --git a/templates/colors/literals-swift4.stencil b/templates/colors/literals-swift4.stencil index bc9696c..3409831 100644 --- a/templates/colors/literals-swift4.stencil +++ b/templates/colors/literals-swift4.stencil @@ -2,7 +2,7 @@ {% if palettes %} {% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit {% if enumName != 'NSColor' %}{{accessModifier}} enum {{enumName}} { }{% endif %} diff --git a/templates/colors/swift2.stencil b/templates/colors/swift2.stencil index 759fd62..b00ff85 100644 --- a/templates/colors/swift2.stencil +++ b/templates/colors/swift2.stencil @@ -2,7 +2,7 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor {{accessModifier}} typealias {{colorAlias}} = NSColor diff --git a/templates/colors/swift3.stencil b/templates/colors/swift3.stencil index 8cb583e..8013af2 100644 --- a/templates/colors/swift3.stencil +++ b/templates/colors/swift3.stencil @@ -2,7 +2,7 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor {{accessModifier}} typealias {{colorAlias}} = NSColor diff --git a/templates/colors/swift4.stencil b/templates/colors/swift4.stencil index 8cb583e..8013af2 100644 --- a/templates/colors/swift4.stencil +++ b/templates/colors/swift4.stencil @@ -2,7 +2,7 @@ {% if palettes %} {% set colorAlias %}{{param.colorAliasName|default:"Color"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSColor {{accessModifier}} typealias {{colorAlias}} = NSColor diff --git a/templates/fonts/swift2.stencil b/templates/fonts/swift2.stencil index 75bb1f1..00a0e3d 100644 --- a/templates/fonts/swift2.stencil +++ b/templates/fonts/swift2.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont {{accessModifier}} typealias Font = NSFont diff --git a/templates/fonts/swift3.stencil b/templates/fonts/swift3.stencil index 73e2007..41963e3 100644 --- a/templates/fonts/swift3.stencil +++ b/templates/fonts/swift3.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont {{accessModifier}} typealias Font = NSFont diff --git a/templates/fonts/swift4.stencil b/templates/fonts/swift4.stencil index 73e2007..41963e3 100644 --- a/templates/fonts/swift4.stencil +++ b/templates/fonts/swift4.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if families %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSFont {{accessModifier}} typealias Font = NSFont diff --git a/templates/storyboards/swift2.stencil b/templates/storyboards/swift2.stencil index ea4ea90..07bc7c6 100644 --- a/templates/storyboards/swift2.stencil +++ b/templates/storyboards/swift2.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} diff --git a/templates/storyboards/swift3.stencil b/templates/storyboards/swift3.stencil index 4faeb39..4dee222 100644 --- a/templates/storyboards/swift3.stencil +++ b/templates/storyboards/swift3.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} diff --git a/templates/storyboards/swift4.stencil b/templates/storyboards/swift4.stencil index 732663a..32555f6 100644 --- a/templates/storyboards/swift4.stencil +++ b/templates/storyboards/swift4.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if platform and storyboards %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} {% set isAppKit %}{% if platform == "macOS" %}true{% endif %}{% endset %} {% set prefix %}{% if isAppKit %}NS{% else %}UI{% endif %}{% endset %} {% set controller %}{% if isAppKit %}Controller{% else %}ViewController{% endif %}{% endset %} diff --git a/templates/strings/flat-swift2.stencil b/templates/strings/flat-swift2.stencil index 65a6306..0001494 100644 --- a/templates/strings/flat-swift2.stencil +++ b/templates/strings/flat-swift2.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/strings/flat-swift3.stencil b/templates/strings/flat-swift3.stencil index 707465b..5c81be7 100644 --- a/templates/strings/flat-swift3.stencil +++ b/templates/strings/flat-swift3.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/strings/flat-swift4.stencil b/templates/strings/flat-swift4.stencil index 64896bc..3a7219c 100644 --- a/templates/strings/flat-swift4.stencil +++ b/templates/strings/flat-swift4.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/strings/structured-swift2.stencil b/templates/strings/structured-swift2.stencil index 6924a51..4570887 100644 --- a/templates/strings/structured-swift2.stencil +++ b/templates/strings/structured-swift2.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/strings/structured-swift3.stencil b/templates/strings/structured-swift3.stencil index 4a547d0..0afb912 100644 --- a/templates/strings/structured-swift3.stencil +++ b/templates/strings/structured-swift3.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/strings/structured-swift4.stencil b/templates/strings/structured-swift4.stencil index 92a31c6..970acec 100644 --- a/templates/strings/structured-swift4.stencil +++ b/templates/strings/structured-swift4.stencil @@ -1,7 +1,7 @@ // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen {% if tables.count > 0 %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} import Foundation // swiftlint:disable superfluous_disable_command diff --git a/templates/xcassets/swift2.stencil b/templates/xcassets/swift2.stencil index 630a422..6738d71 100644 --- a/templates/xcassets/swift2.stencil +++ b/templates/xcassets/swift2.stencil @@ -2,7 +2,7 @@ {% if catalogs %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage {{accessModifier}} typealias {{imageAlias}} = NSImage diff --git a/templates/xcassets/swift3.stencil b/templates/xcassets/swift3.stencil index 9795b32..f460db1 100644 --- a/templates/xcassets/swift3.stencil +++ b/templates/xcassets/swift3.stencil @@ -3,7 +3,7 @@ {% if catalogs %} {% set colorAlias %}{{param.colorAliasName|default:"AssetColorTypeAlias"}}{% endset %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage {{accessModifier}} typealias {{colorAlias}} = NSColor diff --git a/templates/xcassets/swift4.stencil b/templates/xcassets/swift4.stencil index fba0e16..6c64b62 100644 --- a/templates/xcassets/swift4.stencil +++ b/templates/xcassets/swift4.stencil @@ -3,7 +3,7 @@ {% if catalogs %} {% set colorAlias %}{{param.colorAliasName|default:"AssetColorTypeAlias"}}{% endset %} {% set imageAlias %}{{param.imageAliasName|default:"Image"}}{% endset %} -{% set accessModifier %}{% if param.public %}public{% else %}internal{% endif %}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} #if os(OSX) import AppKit.NSImage {{accessModifier}} typealias {{colorAlias}} = NSColor From f7db63b8da2617dcadc821964fcf83c413a8092b Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Wed, 1 Nov 2017 19:49:33 +0100 Subject: [PATCH 5/8] Update Gemfile (sync:all_files) --- Gemfile | 4 ++-- Gemfile.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 14033cb..2ddba99 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'cocoapods', '1.3.1' +gem 'cocoapods', '~> 1.3' gem 'octokit', '~> 4.7' -gem 'rake' +gem 'rake', '~> 10.4' gem 'xcpretty' diff --git a/Gemfile.lock b/Gemfile.lock index b07be50..55f8016 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) public_suffix (2.0.5) - rake (12.0.0) + rake (10.5.0) rouge (2.0.7) ruby-macho (1.1.0) sawyer (0.8.1) @@ -81,10 +81,10 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.3.1) + cocoapods (~> 1.3) octokit (~> 4.7) - rake + rake (~> 10.4) xcpretty BUNDLED WITH - 1.15.3 + 1.16.0 From 2d5a8539fff93b63037324a77375eecd9013e4d1 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Wed, 1 Nov 2017 20:59:05 +0100 Subject: [PATCH 6/8] Add Unit tests for `--param publicAccess` for all templates --- ...swift3-context-defaults-publicAccess.swift | 25 ++++ ...swift4-context-defaults-publicAccess.swift | 25 ++++ ...swift2-context-defaults-publicAccess.swift | 51 +++++++ ...swift3-context-defaults-publicAccess.swift | 51 +++++++ ...swift4-context-defaults-publicAccess.swift | 51 +++++++ ...swift2-context-defaults-publicAccess.swift | 87 +++++++++++ ...swift3-context-defaults-publicAccess.swift | 87 +++++++++++ ...swift4-context-defaults-publicAccess.swift | 87 +++++++++++ .../swift2-context-all-publicAccess.swift | 122 +++++++++++++++ .../swift3-context-all-publicAccess.swift | 122 +++++++++++++++ .../swift4-context-all-publicAccess.swift | 125 ++++++++++++++++ .../swift2-context-all-publicAccess.swift | 104 +++++++++++++ .../swift3-context-all-publicAccess.swift | 104 +++++++++++++ .../swift4-context-all-publicAccess.swift | 107 +++++++++++++ ...ft2-context-localizable-publicAccess.swift | 50 +++++++ ...ft3-context-localizable-publicAccess.swift | 50 +++++++ ...ft4-context-localizable-publicAccess.swift | 50 +++++++ ...ft2-context-localizable-publicAccess.swift | 98 ++++++++++++ ...ft3-context-localizable-publicAccess.swift | 98 ++++++++++++ ...ft4-context-localizable-publicAccess.swift | 98 ++++++++++++ .../swift2-context-all-publicAccess.swift | 115 ++++++++++++++ .../swift3-context-all-publicAccess.swift | 140 ++++++++++++++++++ .../swift4-context-all-publicAccess.swift | 138 +++++++++++++++++ Tests/TemplatesTests/ColorsTests.swift | 5 +- Tests/TemplatesTests/FontsTests.swift | 5 +- .../StoryboardsMacOSTests.swift | 5 +- .../TemplatesTests/StoryboardsiOSTests.swift | 5 +- Tests/TemplatesTests/StringsTests.swift | 5 +- Tests/TemplatesTests/XCAssetsTests.swift | 5 +- 29 files changed, 2009 insertions(+), 6 deletions(-) create mode 100644 Tests/Expected/Colors/literals-swift3-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Colors/literals-swift4-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Colors/swift2-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Colors/swift3-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Colors/swift4-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Fonts/swift2-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Fonts/swift3-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Fonts/swift4-context-defaults-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-iOS/swift2-context-all-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-iOS/swift3-context-all-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-iOS/swift4-context-all-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-macOS/swift2-context-all-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-macOS/swift3-context-all-publicAccess.swift create mode 100644 Tests/Expected/Storyboards-macOS/swift4-context-all-publicAccess.swift create mode 100644 Tests/Expected/Strings/flat-swift2-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/Strings/flat-swift3-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/Strings/flat-swift4-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/Strings/structured-swift2-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/Strings/structured-swift3-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/Strings/structured-swift4-context-localizable-publicAccess.swift create mode 100644 Tests/Expected/XCAssets/swift2-context-all-publicAccess.swift create mode 100644 Tests/Expected/XCAssets/swift3-context-all-publicAccess.swift create mode 100644 Tests/Expected/XCAssets/swift4-context-all-publicAccess.swift diff --git a/Tests/Expected/Colors/literals-swift3-context-defaults-publicAccess.swift b/Tests/Expected/Colors/literals-swift3-context-defaults-publicAccess.swift new file mode 100644 index 0000000..3d36fa5 --- /dev/null +++ b/Tests/Expected/Colors/literals-swift3-context-defaults-publicAccess.swift @@ -0,0 +1,25 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit + public enum ColorName { } +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit + public enum ColorName { } +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable identifier_name line_length type_body_length +public extension ColorName { + /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) + static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) + /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) + static let articleFootnote = #colorLiteral(red: 1.0, green: 0.4, blue: 0.8, alpha: 1.0) + /// 0x33fe66ff (r: 51, g: 254, b: 102, a: 255) + static let articleTitle = #colorLiteral(red: 0.2, green: 0.996078, blue: 0.4, alpha: 1.0) + /// 0xffffffcc (r: 255, g: 255, b: 255, a: 204) + static let `private` = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.8) +} +// swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Colors/literals-swift4-context-defaults-publicAccess.swift b/Tests/Expected/Colors/literals-swift4-context-defaults-publicAccess.swift new file mode 100644 index 0000000..3d36fa5 --- /dev/null +++ b/Tests/Expected/Colors/literals-swift4-context-defaults-publicAccess.swift @@ -0,0 +1,25 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit + public enum ColorName { } +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit + public enum ColorName { } +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable identifier_name line_length type_body_length +public extension ColorName { + /// 0x339666ff (r: 51, g: 150, b: 102, a: 255) + static let articleBody = #colorLiteral(red: 0.2, green: 0.588235, blue: 0.4, alpha: 1.0) + /// 0xff66ccff (r: 255, g: 102, b: 204, a: 255) + static let articleFootnote = #colorLiteral(red: 1.0, green: 0.4, blue: 0.8, alpha: 1.0) + /// 0x33fe66ff (r: 51, g: 254, b: 102, a: 255) + static let articleTitle = #colorLiteral(red: 0.2, green: 0.996078, blue: 0.4, alpha: 1.0) + /// 0xffffffcc (r: 255, g: 255, b: 255, a: 204) + static let `private` = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.8) +} +// swiftlint:enable identifier_name line_length type_body_length diff --git a/Tests/Expected/Colors/swift2-context-defaults-publicAccess.swift b/Tests/Expected/Colors/swift2-context-defaults-publicAccess.swift new file mode 100644 index 0000000..ba6a8bf --- /dev/null +++ b/Tests/Expected/Colors/swift2-context-defaults-publicAccess.swift @@ -0,0 +1,51 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSColor + public typealias Color = NSColor +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIColor + public typealias Color = UIColor +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable operator_usage_whitespace +public extension Color { + convenience init(rgbaValue: UInt32) { + let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 + let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 + let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0 + let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0 + + self.init(red: red, green: green, blue: blue, alpha: alpha) + } +} +// swiftlint:enable operator_usage_whitespace + +// swiftlint:disable identifier_name line_length type_body_length +public struct ColorName { + public let rgbaValue: UInt32 + public var color: Color { return Color(named: self) } + + /// + /// Alpha: 100%
(0x339666ff) + public static let ArticleBody = ColorName(rgbaValue: 0x339666ff) + /// + /// Alpha: 100%
(0xff66ccff) + public static let ArticleFootnote = ColorName(rgbaValue: 0xff66ccff) + /// + /// Alpha: 100%
(0x33fe66ff) + public static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff) + /// + /// Alpha: 80%
(0xffffffcc) + public static let Private = ColorName(rgbaValue: 0xffffffcc) +} +// swiftlint:enable identifier_name line_length type_body_length + +public extension Color { + convenience init(named color: ColorName) { + self.init(rgbaValue: color.rgbaValue) + } +} diff --git a/Tests/Expected/Colors/swift3-context-defaults-publicAccess.swift b/Tests/Expected/Colors/swift3-context-defaults-publicAccess.swift new file mode 100644 index 0000000..8a5f15a --- /dev/null +++ b/Tests/Expected/Colors/swift3-context-defaults-publicAccess.swift @@ -0,0 +1,51 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSColor + public typealias Color = NSColor +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIColor + public typealias Color = UIColor +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable operator_usage_whitespace +public extension Color { + convenience init(rgbaValue: UInt32) { + let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 + let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 + let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0 + let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0 + + self.init(red: red, green: green, blue: blue, alpha: alpha) + } +} +// swiftlint:enable operator_usage_whitespace + +// swiftlint:disable identifier_name line_length type_body_length +public struct ColorName { + public let rgbaValue: UInt32 + public var color: Color { return Color(named: self) } + + /// + /// Alpha: 100%
(0x339666ff) + public static let articleBody = ColorName(rgbaValue: 0x339666ff) + /// + /// Alpha: 100%
(0xff66ccff) + public static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + /// + /// Alpha: 100%
(0x33fe66ff) + public static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + /// + /// Alpha: 80%
(0xffffffcc) + public static let `private` = ColorName(rgbaValue: 0xffffffcc) +} +// swiftlint:enable identifier_name line_length type_body_length + +public extension Color { + convenience init(named color: ColorName) { + self.init(rgbaValue: color.rgbaValue) + } +} diff --git a/Tests/Expected/Colors/swift4-context-defaults-publicAccess.swift b/Tests/Expected/Colors/swift4-context-defaults-publicAccess.swift new file mode 100644 index 0000000..8a5f15a --- /dev/null +++ b/Tests/Expected/Colors/swift4-context-defaults-publicAccess.swift @@ -0,0 +1,51 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSColor + public typealias Color = NSColor +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIColor + public typealias Color = UIColor +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable operator_usage_whitespace +public extension Color { + convenience init(rgbaValue: UInt32) { + let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0 + let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0 + let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0 + let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0 + + self.init(red: red, green: green, blue: blue, alpha: alpha) + } +} +// swiftlint:enable operator_usage_whitespace + +// swiftlint:disable identifier_name line_length type_body_length +public struct ColorName { + public let rgbaValue: UInt32 + public var color: Color { return Color(named: self) } + + /// + /// Alpha: 100%
(0x339666ff) + public static let articleBody = ColorName(rgbaValue: 0x339666ff) + /// + /// Alpha: 100%
(0xff66ccff) + public static let articleFootnote = ColorName(rgbaValue: 0xff66ccff) + /// + /// Alpha: 100%
(0x33fe66ff) + public static let articleTitle = ColorName(rgbaValue: 0x33fe66ff) + /// + /// Alpha: 80%
(0xffffffcc) + public static let `private` = ColorName(rgbaValue: 0xffffffcc) +} +// swiftlint:enable identifier_name line_length type_body_length + +public extension Color { + convenience init(named color: ColorName) { + self.init(rgbaValue: color.rgbaValue) + } +} diff --git a/Tests/Expected/Fonts/swift2-context-defaults-publicAccess.swift b/Tests/Expected/Fonts/swift2-context-defaults-publicAccess.swift new file mode 100644 index 0000000..cee75fb --- /dev/null +++ b/Tests/Expected/Fonts/swift2-context-defaults-publicAccess.swift @@ -0,0 +1,87 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSFont + public typealias Font = NSFont +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIFont + public typealias Font = UIFont +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public struct FontConvertible { + public let name: String + public let family: String + public let path: String + + public func font(size: CGFloat) -> Font! { + return Font(font: self, size: size) + } + + public func register() { + guard let url = url else { return } + var errorRef: Unmanaged? + CTFontManagerRegisterFontsForURL(url as CFURL, .Process, &errorRef) + } + + fileprivate var url: NSURL? { + let bundle = NSBundle(forClass: BundleToken.self) + return bundle.URLForResource(path, withExtension: nil) + } +} + +public extension Font { + convenience init!(font: FontConvertible, size: CGFloat) { + #if os(iOS) || os(tvOS) || os(watchOS) + if !UIFont.fontNamesForFamilyName(font.family).contains(font.name) { + font.register() + } + #elseif os(OSX) + if let url = font.url, CTFontManagerGetScopeForURL(url as CFURL) == .None { + font.register() + } + #endif + + self.init(name: font.name, size: size) + } +} + +// swiftlint:disable identifier_name line_length type_body_length +public enum FontFamily { + public enum SFNSDisplay { + public static let Black = FontConvertible(".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + public static let Bold = FontConvertible(".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + public static let Heavy = FontConvertible(".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + public static let Regular = FontConvertible(".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") + } + public enum SFNSText { + public static let Bold = FontConvertible(".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + public static let Heavy = FontConvertible(".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + public static let Regular = FontConvertible(".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + } + public enum Avenir { + public static let Black = FontConvertible("Avenir-Black", family: "Avenir", path: "Avenir.ttc") + public static let BlackOblique = FontConvertible("Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + public static let Book = FontConvertible("Avenir-Book", family: "Avenir", path: "Avenir.ttc") + public static let BookOblique = FontConvertible("Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + public static let Heavy = FontConvertible("Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + public static let HeavyOblique = FontConvertible("Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + public static let Light = FontConvertible("Avenir-Light", family: "Avenir", path: "Avenir.ttc") + public static let LightOblique = FontConvertible("Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + public static let Medium = FontConvertible("Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + public static let MediumOblique = FontConvertible("Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + public static let Oblique = FontConvertible("Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + public static let Roman = FontConvertible("Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + } + public enum ZapfDingbats { + public static let Regular = FontConvertible("ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + } + public enum Public { + public static let Internal = FontConvertible("private", family: "public", path: "class.ttf") + } +} +// swiftlint:enable identifier_name line_length type_body_length + +private final class BundleToken {} diff --git a/Tests/Expected/Fonts/swift3-context-defaults-publicAccess.swift b/Tests/Expected/Fonts/swift3-context-defaults-publicAccess.swift new file mode 100644 index 0000000..8e85a62 --- /dev/null +++ b/Tests/Expected/Fonts/swift3-context-defaults-publicAccess.swift @@ -0,0 +1,87 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSFont + public typealias Font = NSFont +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIFont + public typealias Font = UIFont +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public struct FontConvertible { + public let name: String + public let family: String + public let path: String + + public func font(size: CGFloat) -> Font! { + return Font(font: self, size: size) + } + + public func register() { + guard let url = url else { return } + var errorRef: Unmanaged? + CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) + } + + fileprivate var url: URL? { + let bundle = Bundle(for: BundleToken.self) + return bundle.url(forResource: path, withExtension: nil) + } +} + +public extension Font { + convenience init!(font: FontConvertible, size: CGFloat) { + #if os(iOS) || os(tvOS) || os(watchOS) + if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { + font.register() + } + #elseif os(OSX) + if let url = font.url, CTFontManagerGetScopeForURL(url as CFURL) == .none { + font.register() + } + #endif + + self.init(name: font.name, size: size) + } +} + +// swiftlint:disable identifier_name line_length type_body_length +public enum FontFamily { + public enum SFNSDisplay { + public static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + public static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + public static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + public static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") + } + public enum SFNSText { + public static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + public static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + public static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + } + public enum Avenir { + public static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + public static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + public static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + public static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + public static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + public static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + public static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + public static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + public static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + public static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + public static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + public static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + } + public enum ZapfDingbats { + public static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + } + public enum Public { + public static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + } +} +// swiftlint:enable identifier_name line_length type_body_length + +private final class BundleToken {} diff --git a/Tests/Expected/Fonts/swift4-context-defaults-publicAccess.swift b/Tests/Expected/Fonts/swift4-context-defaults-publicAccess.swift new file mode 100644 index 0000000..8e85a62 --- /dev/null +++ b/Tests/Expected/Fonts/swift4-context-defaults-publicAccess.swift @@ -0,0 +1,87 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSFont + public typealias Font = NSFont +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIFont + public typealias Font = UIFont +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public struct FontConvertible { + public let name: String + public let family: String + public let path: String + + public func font(size: CGFloat) -> Font! { + return Font(font: self, size: size) + } + + public func register() { + guard let url = url else { return } + var errorRef: Unmanaged? + CTFontManagerRegisterFontsForURL(url as CFURL, .process, &errorRef) + } + + fileprivate var url: URL? { + let bundle = Bundle(for: BundleToken.self) + return bundle.url(forResource: path, withExtension: nil) + } +} + +public extension Font { + convenience init!(font: FontConvertible, size: CGFloat) { + #if os(iOS) || os(tvOS) || os(watchOS) + if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { + font.register() + } + #elseif os(OSX) + if let url = font.url, CTFontManagerGetScopeForURL(url as CFURL) == .none { + font.register() + } + #endif + + self.init(name: font.name, size: size) + } +} + +// swiftlint:disable identifier_name line_length type_body_length +public enum FontFamily { + public enum SFNSDisplay { + public static let black = FontConvertible(name: ".SFNSDisplay-Black", family: ".SF NS Display", path: "SFNSDisplay-Black.otf") + public static let bold = FontConvertible(name: ".SFNSDisplay-Bold", family: ".SF NS Display", path: "SFNSDisplay-Bold.otf") + public static let heavy = FontConvertible(name: ".SFNSDisplay-Heavy", family: ".SF NS Display", path: "SFNSDisplay-Heavy.otf") + public static let regular = FontConvertible(name: ".SFNSDisplay-Regular", family: ".SF NS Display", path: "SFNSDisplay-Regular.otf") + } + public enum SFNSText { + public static let bold = FontConvertible(name: ".SFNSText-Bold", family: ".SF NS Text", path: "SFNSText-Bold.otf") + public static let heavy = FontConvertible(name: ".SFNSText-Heavy", family: ".SF NS Text", path: "SFNSText-Heavy.otf") + public static let regular = FontConvertible(name: ".SFNSText-Regular", family: ".SF NS Text", path: "SFNSText-Regular.otf") + } + public enum Avenir { + public static let black = FontConvertible(name: "Avenir-Black", family: "Avenir", path: "Avenir.ttc") + public static let blackOblique = FontConvertible(name: "Avenir-BlackOblique", family: "Avenir", path: "Avenir.ttc") + public static let book = FontConvertible(name: "Avenir-Book", family: "Avenir", path: "Avenir.ttc") + public static let bookOblique = FontConvertible(name: "Avenir-BookOblique", family: "Avenir", path: "Avenir.ttc") + public static let heavy = FontConvertible(name: "Avenir-Heavy", family: "Avenir", path: "Avenir.ttc") + public static let heavyOblique = FontConvertible(name: "Avenir-HeavyOblique", family: "Avenir", path: "Avenir.ttc") + public static let light = FontConvertible(name: "Avenir-Light", family: "Avenir", path: "Avenir.ttc") + public static let lightOblique = FontConvertible(name: "Avenir-LightOblique", family: "Avenir", path: "Avenir.ttc") + public static let medium = FontConvertible(name: "Avenir-Medium", family: "Avenir", path: "Avenir.ttc") + public static let mediumOblique = FontConvertible(name: "Avenir-MediumOblique", family: "Avenir", path: "Avenir.ttc") + public static let oblique = FontConvertible(name: "Avenir-Oblique", family: "Avenir", path: "Avenir.ttc") + public static let roman = FontConvertible(name: "Avenir-Roman", family: "Avenir", path: "Avenir.ttc") + } + public enum ZapfDingbats { + public static let regular = FontConvertible(name: "ZapfDingbatsITC", family: "Zapf Dingbats", path: "ZapfDingbats.ttf") + } + public enum Public { + public static let `internal` = FontConvertible(name: "private", family: "public", path: "class.ttf") + } +} +// swiftlint:enable identifier_name line_length type_body_length + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-iOS/swift2-context-all-publicAccess.swift b/Tests/Expected/Storyboards-iOS/swift2-context-all-publicAccess.swift new file mode 100644 index 0000000..254f936 --- /dev/null +++ b/Tests/Expected/Storyboards-iOS/swift2-context-all-publicAccess.swift @@ -0,0 +1,122 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import UIKit +import CustomSegue +import LocationPicker +import SlackTextViewController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: UIStoryboard { + return UIStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public var controller: T { + guard let controller = storyboard.storyboard.instantiateViewControllerWithIdentifier(identifier) as? T else { + fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public var controller: T { + guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { + fatalError("Controller is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension UIViewController { + func performSegue(segue: S, sender: AnyObject? = nil) { + performSegueWithIdentifier(segue.rawValue, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let initialScene = InitialSceneType(AdditionalImport.self) + + public static let Public = SceneType(AdditionalImport.self, identifier: "public") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + + public static let initialScene = InitialSceneType(Anonymous.self) + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let initialScene = InitialSceneType(Message.self) + + public static let Composer = SceneType(Message.self, identifier: "Composer") + + public static let MessagesList = SceneType(Message.self, identifier: "MessagesList") + + public static let NavCtrl = SceneType(Message.self, identifier: "NavCtrl") + + public static let URLChooser = SceneType(Message.self, identifier: "URLChooser") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let Navigation = SceneType(Placeholder.self, identifier: "Navigation") + } + public enum Wizard: StoryboardType { + public static let storyboardName = "Wizard" + + public static let initialScene = InitialSceneType(Wizard.self) + + public static let AcceptCGU = SceneType(Wizard.self, identifier: "Accept-CGU") + + public static let CreateAccount = SceneType(Wizard.self, identifier: "CreateAccount") + + public static let Preferences = SceneType(Wizard.self, identifier: "Preferences") + + public static let ValidatePassword = SceneType(Wizard.self, identifier: "Validate_Password") + } +} + +public enum StoryboardSegue { + public enum AdditionalImport: String, SegueType { + case Private = "private" + } + public enum Message: String, SegueType { + case CustomBack + case Embed + case NonCustom + case ShowNavCtrl = "Show-NavCtrl" + } + public enum Wizard: String, SegueType { + case ShowPassword + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-iOS/swift3-context-all-publicAccess.swift b/Tests/Expected/Storyboards-iOS/swift3-context-all-publicAccess.swift new file mode 100644 index 0000000..44fc96d --- /dev/null +++ b/Tests/Expected/Storyboards-iOS/swift3-context-all-publicAccess.swift @@ -0,0 +1,122 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import UIKit +import CustomSegue +import LocationPicker +import SlackTextViewController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: UIStoryboard { + return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { + fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { + fatalError("ViewController is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension UIViewController { + func perform(segue: S, sender: Any? = nil) where S.RawValue == String { + performSegue(withIdentifier: segue.rawValue, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + + public static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + + public static let initialScene = InitialSceneType(storyboard: Anonymous.self) + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let initialScene = InitialSceneType(storyboard: Message.self) + + public static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + + public static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + + public static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + + public static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + } + public enum Wizard: StoryboardType { + public static let storyboardName = "Wizard" + + public static let initialScene = InitialSceneType(storyboard: Wizard.self) + + public static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + + public static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + + public static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + + public static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + } +} + +public enum StoryboardSegue { + public enum AdditionalImport: String, SegueType { + case `private` + } + public enum Message: String, SegueType { + case customBack = "CustomBack" + case embed = "Embed" + case nonCustom = "NonCustom" + case showNavCtrl = "Show-NavCtrl" + } + public enum Wizard: String, SegueType { + case showPassword = "ShowPassword" + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-iOS/swift4-context-all-publicAccess.swift b/Tests/Expected/Storyboards-iOS/swift4-context-all-publicAccess.swift new file mode 100644 index 0000000..db20753 --- /dev/null +++ b/Tests/Expected/Storyboards-iOS/swift4-context-all-publicAccess.swift @@ -0,0 +1,125 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import UIKit +import CustomSegue +import LocationPicker +import SlackTextViewController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: UIStoryboard { + let name = self.storyboardName + return UIStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public func instantiate() -> T { + let identifier = self.identifier + guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else { + fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else { + fatalError("ViewController is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension UIViewController { + func perform(segue: S, sender: Any? = nil) where S.RawValue == String { + let identifier = segue.rawValue + performSegue(withIdentifier: identifier, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let initialScene = InitialSceneType(storyboard: AdditionalImport.self) + + public static let `public` = SceneType(storyboard: AdditionalImport.self, identifier: "public") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + + public static let initialScene = InitialSceneType(storyboard: Anonymous.self) + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let initialScene = InitialSceneType(storyboard: Message.self) + + public static let composer = SceneType(storyboard: Message.self, identifier: "Composer") + + public static let messagesList = SceneType(storyboard: Message.self, identifier: "MessagesList") + + public static let navCtrl = SceneType(storyboard: Message.self, identifier: "NavCtrl") + + public static let urlChooser = SceneType(storyboard: Message.self, identifier: "URLChooser") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let navigation = SceneType(storyboard: Placeholder.self, identifier: "Navigation") + } + public enum Wizard: StoryboardType { + public static let storyboardName = "Wizard" + + public static let initialScene = InitialSceneType(storyboard: Wizard.self) + + public static let acceptCGU = SceneType(storyboard: Wizard.self, identifier: "Accept-CGU") + + public static let createAccount = SceneType(storyboard: Wizard.self, identifier: "CreateAccount") + + public static let preferences = SceneType(storyboard: Wizard.self, identifier: "Preferences") + + public static let validatePassword = SceneType(storyboard: Wizard.self, identifier: "Validate_Password") + } +} + +public enum StoryboardSegue { + public enum AdditionalImport: String, SegueType { + case `private` + } + public enum Message: String, SegueType { + case customBack = "CustomBack" + case embed = "Embed" + case nonCustom = "NonCustom" + case showNavCtrl = "Show-NavCtrl" + } + public enum Wizard: String, SegueType { + case showPassword = "ShowPassword" + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-macOS/swift2-context-all-publicAccess.swift b/Tests/Expected/Storyboards-macOS/swift2-context-all-publicAccess.swift new file mode 100644 index 0000000..675f16e --- /dev/null +++ b/Tests/Expected/Storyboards-macOS/swift2-context-all-publicAccess.swift @@ -0,0 +1,104 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import Cocoa +import FadeSegue +import PrefsWindowController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: NSStoryboard { + return NSStoryboard(name: self.storyboardName, bundle: NSBundle(forClass: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public var controller: T { + guard let controller = storyboard.storyboard.instantiateControllerWithIdentifier(identifier) as? T else { + fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public var controller: T { + guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { + fatalError("Controller is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension NSSeguePerforming { + func performSegue(segue: S, sender: AnyObject? = nil) { + performSegueWithIdentifier?(segue.rawValue, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let Private = SceneType(AdditionalImport.self, identifier: "private") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let Dependent = SceneType(Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let MessageDetails = SceneType(Message.self, identifier: "MessageDetails") + + public static let MessageList = SceneType(Message.self, identifier: "MessageList") + + public static let MessageListFooter = SceneType(Message.self, identifier: "MessageListFooter") + + public static let MessagesTab = SceneType(Message.self, identifier: "MessagesTab") + + public static let SplitMessages = SceneType(Message.self, identifier: "SplitMessages") + + public static let WindowCtrl = SceneType(Message.self, identifier: "WindowCtrl") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let Dependent = SceneType(Placeholder.self, identifier: "Dependent") + + public static let Window = SceneType(Placeholder.self, identifier: "Window") + } +} + +public enum StoryboardSegue { + public enum Message: String, SegueType { + case Embed + case Modal + case Popover + case Sheet + case Show + case Public = "public" + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-macOS/swift3-context-all-publicAccess.swift b/Tests/Expected/Storyboards-macOS/swift3-context-all-publicAccess.swift new file mode 100644 index 0000000..2d32883 --- /dev/null +++ b/Tests/Expected/Storyboards-macOS/swift3-context-all-publicAccess.swift @@ -0,0 +1,104 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import Cocoa +import FadeSegue +import PrefsWindowController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: NSStoryboard { + return NSStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { + fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { + fatalError("Controller is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension NSSeguePerforming { + func perform(segue: S, sender: Any? = nil) where S.RawValue == String { + performSegue?(withIdentifier: segue.rawValue, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + + public static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + + public static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + + public static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + + public static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + + public static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + + public static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + } +} + +public enum StoryboardSegue { + public enum Message: String, SegueType { + case embed = "Embed" + case modal = "Modal" + case popover = "Popover" + case sheet = "Sheet" + case show = "Show" + case `public` + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Storyboards-macOS/swift4-context-all-publicAccess.swift b/Tests/Expected/Storyboards-macOS/swift4-context-all-publicAccess.swift new file mode 100644 index 0000000..6f26cfe --- /dev/null +++ b/Tests/Expected/Storyboards-macOS/swift4-context-all-publicAccess.swift @@ -0,0 +1,107 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +// swiftlint:disable sorted_imports +import Foundation +import Cocoa +import FadeSegue +import PrefsWindowController + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +public protocol StoryboardType { + static var storyboardName: String { get } +} + +public extension StoryboardType { + static var storyboard: NSStoryboard { + let name = NSStoryboard.Name(self.storyboardName) + return NSStoryboard(name: name, bundle: Bundle(for: BundleToken.self)) + } +} + +public struct SceneType { + public let storyboard: StoryboardType.Type + public let identifier: String + + public func instantiate() -> T { + let identifier = NSStoryboard.SceneIdentifier(self.identifier) + guard let controller = storyboard.storyboard.instantiateController(withIdentifier: identifier) as? T else { + fatalError("Controller '\(identifier)' is not of the expected class \(T.self).") + } + return controller + } +} + +public struct InitialSceneType { + public let storyboard: StoryboardType.Type + + public func instantiate() -> T { + guard let controller = storyboard.storyboard.instantiateInitialController() as? T else { + fatalError("Controller is not of the expected class \(T.self).") + } + return controller + } +} + +public protocol SegueType: RawRepresentable { } + +public extension NSSeguePerforming { + func perform(segue: S, sender: Any? = nil) where S.RawValue == String { + let identifier = NSStoryboardSegue.Identifier(segue.rawValue) + performSegue?(withIdentifier: identifier, sender: sender) + } +} + +// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name +public enum StoryboardScene { + public enum AdditionalImport: StoryboardType { + public static let storyboardName = "AdditionalImport" + + public static let `private` = SceneType(storyboard: AdditionalImport.self, identifier: "private") + } + public enum Anonymous: StoryboardType { + public static let storyboardName = "Anonymous" + } + public enum Dependency: StoryboardType { + public static let storyboardName = "Dependency" + + public static let dependent = SceneType(storyboard: Dependency.self, identifier: "Dependent") + } + public enum Message: StoryboardType { + public static let storyboardName = "Message" + + public static let messageDetails = SceneType(storyboard: Message.self, identifier: "MessageDetails") + + public static let messageList = SceneType(storyboard: Message.self, identifier: "MessageList") + + public static let messageListFooter = SceneType(storyboard: Message.self, identifier: "MessageListFooter") + + public static let messagesTab = SceneType(storyboard: Message.self, identifier: "MessagesTab") + + public static let splitMessages = SceneType(storyboard: Message.self, identifier: "SplitMessages") + + public static let windowCtrl = SceneType(storyboard: Message.self, identifier: "WindowCtrl") + } + public enum Placeholder: StoryboardType { + public static let storyboardName = "Placeholder" + + public static let dependent = SceneType(storyboard: Placeholder.self, identifier: "Dependent") + + public static let window = SceneType(storyboard: Placeholder.self, identifier: "Window") + } +} + +public enum StoryboardSegue { + public enum Message: String, SegueType { + case embed = "Embed" + case modal = "Modal" + case popover = "Popover" + case sheet = "Sheet" + case show = "Show" + case `public` + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/flat-swift2-context-localizable-publicAccess.swift b/Tests/Expected/Strings/flat-swift2-context-localizable-publicAccess.swift new file mode 100644 index 0000000..a5dff37 --- /dev/null +++ b/Tests/Expected/Strings/flat-swift2-context-localizable-publicAccess.swift @@ -0,0 +1,50 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable identifier_name line_length type_body_length +public enum L10n { + /// Some alert body there + public static let AlertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let AlertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func Private(p1: String, p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + /// You have %d apples + public static func ApplesCount(p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + /// Those %d bananas belong to %@. + public static func BananasOwner(p1: Int, p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + /// Some Reserved Keyword there + public static let SettingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + /// DeepSettings + public static let SettingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + /// Settings + public static let SettingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + /// Here you can change some user profile settings. + public static let SeTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let SettingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") +} +// swiftlint:enable identifier_name line_length type_body_length + +extension L10n { + private static func tr(table: String, _ key: String, _ args: CVarArgType...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: NSBundle(forClass: BundleToken.self), comment: "") + return String(format: format, locale: NSLocale.currentLocale(), arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/flat-swift3-context-localizable-publicAccess.swift b/Tests/Expected/Strings/flat-swift3-context-localizable-publicAccess.swift new file mode 100644 index 0000000..31666f5 --- /dev/null +++ b/Tests/Expected/Strings/flat-swift3-context-localizable-publicAccess.swift @@ -0,0 +1,50 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable identifier_name line_length type_body_length +public enum L10n { + /// Some alert body there + public static let alertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let alertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func `private`(_ p1: String, _ p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + /// You have %d apples + public static func applesCount(_ p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + /// Those %d bananas belong to %@. + public static func bananasOwner(_ p1: Int, _ p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + /// Some Reserved Keyword there + public static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + /// DeepSettings + public static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + /// Settings + public static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + /// Here you can change some user profile settings. + public static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") +} +// swiftlint:enable identifier_name line_length type_body_length + +extension L10n { + fileprivate static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: Bundle(for: BundleToken.self), comment: "") + return String(format: format, locale: Locale.current, arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/flat-swift4-context-localizable-publicAccess.swift b/Tests/Expected/Strings/flat-swift4-context-localizable-publicAccess.swift new file mode 100644 index 0000000..108d06c --- /dev/null +++ b/Tests/Expected/Strings/flat-swift4-context-localizable-publicAccess.swift @@ -0,0 +1,50 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable identifier_name line_length type_body_length +public enum L10n { + /// Some alert body there + public static let alertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let alertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func `private`(_ p1: String, _ p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + /// You have %d apples + public static func applesCount(_ p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + /// Those %d bananas belong to %@. + public static func bananasOwner(_ p1: Int, _ p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + /// Some Reserved Keyword there + public static let settingsNavigationBarSelf = L10n.tr("Localizable", "settings.navigation-bar.self") + /// DeepSettings + public static let settingsNavigationBarTitleDeeperThanWeCanHandleNoReallyThisIsDeep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + /// Settings + public static let settingsNavigationBarTitleEvenDeeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + /// Here you can change some user profile settings. + public static let seTTingsUSerProFileSectioNFooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let settingsUserProfileSectionHeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") +} +// swiftlint:enable identifier_name line_length type_body_length + +extension L10n { + private static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: Bundle(for: BundleToken.self), comment: "") + return String(format: format, locale: Locale.current, arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/structured-swift2-context-localizable-publicAccess.swift b/Tests/Expected/Strings/structured-swift2-context-localizable-publicAccess.swift new file mode 100644 index 0000000..26e9ef7 --- /dev/null +++ b/Tests/Expected/Strings/structured-swift2-context-localizable-publicAccess.swift @@ -0,0 +1,98 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name +public enum L10n { + /// Some alert body there + public static let AlertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let AlertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func ObjectOwnership(p1: Int, p2: String, p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func Private(p1: String, p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + + public enum Apples { + /// You have %d apples + public static func Count(p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + } + + public enum Bananas { + /// Those %d bananas belong to %@. + public static func Owner(p1: Int, p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + } + + public enum Settings { + + public enum NavigationBar { + /// Some Reserved Keyword there + public static let `Self` = L10n.tr("Localizable", "settings.navigation-bar.self") + + public enum Title { + + public enum Deeper { + + public enum Than { + + public enum We { + + public enum Can { + + public enum Handle { + + public enum No { + + public enum Really { + + public enum This { + + public enum Is { + /// DeepSettings + public static let Deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + } + } + } + } + } + } + } + } + } + + public enum Even { + /// Settings + public static let Deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + } + } + } + + public enum UserProfileSection { + /// Here you can change some user profile settings. + public static let FooterText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let HeaderTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + } + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name + +extension L10n { + private static func tr(table: String, _ key: String, _ args: CVarArgType...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: NSBundle(forClass: BundleToken.self), comment: "") + return String(format: format, locale: NSLocale.currentLocale(), arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/structured-swift3-context-localizable-publicAccess.swift b/Tests/Expected/Strings/structured-swift3-context-localizable-publicAccess.swift new file mode 100644 index 0000000..aa7714c --- /dev/null +++ b/Tests/Expected/Strings/structured-swift3-context-localizable-publicAccess.swift @@ -0,0 +1,98 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name +public enum L10n { + /// Some alert body there + public static let alertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let alertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func `private`(_ p1: String, _ p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + + public enum Apples { + /// You have %d apples + public static func count(_ p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + } + + public enum Bananas { + /// Those %d bananas belong to %@. + public static func owner(_ p1: Int, _ p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + } + + public enum Settings { + + public enum NavigationBar { + /// Some Reserved Keyword there + public static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + + public enum Title { + + public enum Deeper { + + public enum Than { + + public enum We { + + public enum Can { + + public enum Handle { + + public enum No { + + public enum Really { + + public enum This { + + public enum Is { + /// DeepSettings + public static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + } + } + } + } + } + } + } + } + } + + public enum Even { + /// Settings + public static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + } + } + } + + public enum UserProfileSection { + /// Here you can change some user profile settings. + public static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + } + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name + +extension L10n { + fileprivate static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: Bundle(for: BundleToken.self), comment: "") + return String(format: format, locale: Locale.current, arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/Strings/structured-swift4-context-localizable-publicAccess.swift b/Tests/Expected/Strings/structured-swift4-context-localizable-publicAccess.swift new file mode 100644 index 0000000..7cf46a5 --- /dev/null +++ b/Tests/Expected/Strings/structured-swift4-context-localizable-publicAccess.swift @@ -0,0 +1,98 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +import Foundation + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name +public enum L10n { + /// Some alert body there + public static let alertMessage = L10n.tr("Localizable", "alert_message") + /// Title of the alert + public static let alertTitle = L10n.tr("Localizable", "alert_title") + /// These are %3$@'s %1$d %2$@. + public static func objectOwnership(_ p1: Int, _ p2: String, _ p3: String) -> String { + return L10n.tr("Localizable", "ObjectOwnership", p1, p2, p3) + } + /// Hello, my name is %@ and I'm %d + public static func `private`(_ p1: String, _ p2: Int) -> String { + return L10n.tr("Localizable", "private", p1, p2) + } + + public enum Apples { + /// You have %d apples + public static func count(_ p1: Int) -> String { + return L10n.tr("Localizable", "apples.count", p1) + } + } + + public enum Bananas { + /// Those %d bananas belong to %@. + public static func owner(_ p1: Int, _ p2: String) -> String { + return L10n.tr("Localizable", "bananas.owner", p1, p2) + } + } + + public enum Settings { + + public enum NavigationBar { + /// Some Reserved Keyword there + public static let `self` = L10n.tr("Localizable", "settings.navigation-bar.self") + + public enum Title { + + public enum Deeper { + + public enum Than { + + public enum We { + + public enum Can { + + public enum Handle { + + public enum No { + + public enum Really { + + public enum This { + + public enum Is { + /// DeepSettings + public static let deep = L10n.tr("Localizable", "settings.navigation-bar.title.deeper.than.we.can.handle.no.really.this.is.deep") + } + } + } + } + } + } + } + } + } + + public enum Even { + /// Settings + public static let deeper = L10n.tr("Localizable", "settings.navigation-bar.title.even.deeper") + } + } + } + + public enum UserProfileSection { + /// Here you can change some user profile settings. + public static let footerText = L10n.tr("Localizable", "seTTings.uSer-proFile-sectioN.footer_text") + /// User Profile Settings + public static let headerTitle = L10n.tr("Localizable", "SETTINGS.USER_PROFILE_SECTION.HEADER_TITLE") + } + } +} +// swiftlint:enable explicit_type_interface identifier_name line_length nesting type_body_length type_name + +extension L10n { + private static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { + let format = NSLocalizedString(key, tableName: table, bundle: Bundle(for: BundleToken.self), comment: "") + return String(format: format, locale: Locale.current, arguments: args) + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/XCAssets/swift2-context-all-publicAccess.swift b/Tests/Expected/XCAssets/swift2-context-all-publicAccess.swift new file mode 100644 index 0000000..d7c5d6e --- /dev/null +++ b/Tests/Expected/XCAssets/swift2-context-all-publicAccess.swift @@ -0,0 +1,115 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSImage + public typealias Image = NSImage +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIImage + public typealias Image = UIImage +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +@available(*, deprecated, renamed: "ImageAsset") +public typealias AssetType = ImageAsset + +public struct ImageAsset { + public private(set) var name: String + + public var image: Image { + let bundle = NSBundle(forClass: BundleToken.self) + #if os(iOS) || os(tvOS) + let image = Image(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) + #elseif os(OSX) + let image = bundle.imageForResource(name) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { fatalError("Unable to load image named \(name).") } + return result + } +} + +public struct ColorAsset { + public fileprivate(set) var name: String +} + +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +public enum Asset { + public enum Colors { + public enum _24Vision { + public static let Background = ColorAsset(name: "24Vision/Background") + public static let Primary = ColorAsset(name: "24Vision/Primary") + } + public static let Orange = ImageAsset(name: "Orange") + public enum Vengo { + public static let Primary = ColorAsset(name: "Vengo/Primary") + public static let Tint = ColorAsset(name: "Vengo/Tint") + } + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + _24Vision.Background, + _24Vision.Primary, + Vengo.Primary, + Vengo.Tint, + ] + public static let allImages: [ImageAsset] = [ + Orange, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } + public enum Images { + public enum Exotic { + public static let Banana = ImageAsset(name: "Exotic/Banana") + public static let Mango = ImageAsset(name: "Exotic/Mango") + } + public enum Round { + public static let Apricot = ImageAsset(name: "Round/Apricot") + public enum Red { + public static let Apple = ImageAsset(name: "Round/Apple") + public enum Double { + public static let Cherry = ImageAsset(name: "Round/Double/Cherry") + } + public static let Tomato = ImageAsset(name: "Round/Tomato") + } + } + public static let Private = ImageAsset(name: "private") + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + ] + public static let allImages: [ImageAsset] = [ + Exotic.Banana, + Exotic.Mango, + Round.Apricot, + Round.Red.Apple, + Round.Red.Double.Cherry, + Round.Red.Tomato, + Private, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +public extension Image { + @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) + @available(OSX, deprecated, + message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") + convenience init!(asset: ImageAsset) { + #if os(iOS) || os(tvOS) + let bundle = NSBundle(forClass: BundleToken.self) + self.init(named: asset.name, inBundle: bundle, compatibleWithTraitCollection: nil) + #elseif os(OSX) || os(watchOS) + self.init(named: asset.name) + #endif + } +} + +private final class BundleToken {} diff --git a/Tests/Expected/XCAssets/swift3-context-all-publicAccess.swift b/Tests/Expected/XCAssets/swift3-context-all-publicAccess.swift new file mode 100644 index 0000000..d0483c7 --- /dev/null +++ b/Tests/Expected/XCAssets/swift3-context-all-publicAccess.swift @@ -0,0 +1,140 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSImage + public typealias AssetColorTypeAlias = NSColor + public typealias Image = NSImage +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIImage + public typealias AssetColorTypeAlias = UIColor + public typealias Image = UIImage +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +@available(*, deprecated, renamed: "ImageAsset") +public typealias AssetType = ImageAsset + +public struct ImageAsset { + public fileprivate(set) var name: String + + public var image: Image { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + let image = Image(named: name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + let image = bundle.image(forResource: name) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { fatalError("Unable to load image named \(name).") } + return result + } +} + +public struct ColorAsset { + public fileprivate(set) var name: String + + #if swift(>=3.2) + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + public var color: AssetColorTypeAlias { + return AssetColorTypeAlias(asset: self) + } + #endif +} + +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +public enum Asset { + public enum Colors { + public enum _24Vision { + public static let background = ColorAsset(name: "24Vision/Background") + public static let primary = ColorAsset(name: "24Vision/Primary") + } + public static let orange = ImageAsset(name: "Orange") + public enum Vengo { + public static let primary = ColorAsset(name: "Vengo/Primary") + public static let tint = ColorAsset(name: "Vengo/Tint") + } + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + _24Vision.background, + _24Vision.primary, + Vengo.primary, + Vengo.tint, + ] + public static let allImages: [ImageAsset] = [ + orange, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } + public enum Images { + public enum Exotic { + public static let banana = ImageAsset(name: "Exotic/Banana") + public static let mango = ImageAsset(name: "Exotic/Mango") + } + public enum Round { + public static let apricot = ImageAsset(name: "Round/Apricot") + public enum Red { + public static let apple = ImageAsset(name: "Round/Apple") + public enum Double { + public static let cherry = ImageAsset(name: "Round/Double/Cherry") + } + public static let tomato = ImageAsset(name: "Round/Tomato") + } + } + public static let `private` = ImageAsset(name: "private") + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + ] + public static let allImages: [ImageAsset] = [ + Exotic.banana, + Exotic.mango, + Round.apricot, + Round.Red.apple, + Round.Red.Double.cherry, + Round.Red.tomato, + `private`, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +public extension Image { + @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) + @available(OSX, deprecated, + message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") + convenience init!(asset: ImageAsset) { + #if os(iOS) || os(tvOS) + let bundle = Bundle(for: BundleToken.self) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) || os(watchOS) + self.init(named: asset.name) + #endif + } +} + +public extension AssetColorTypeAlias { + #if swift(>=3.2) + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + convenience init!(asset: ColorAsset) { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + self.init(named: asset.name, bundle: bundle) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } + #endif +} + +private final class BundleToken {} diff --git a/Tests/Expected/XCAssets/swift4-context-all-publicAccess.swift b/Tests/Expected/XCAssets/swift4-context-all-publicAccess.swift new file mode 100644 index 0000000..070907c --- /dev/null +++ b/Tests/Expected/XCAssets/swift4-context-all-publicAccess.swift @@ -0,0 +1,138 @@ +// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSImage + public typealias AssetColorTypeAlias = NSColor + public typealias Image = NSImage +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIImage + public typealias AssetColorTypeAlias = UIColor + public typealias Image = UIImage +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +@available(*, deprecated, renamed: "ImageAsset") +public typealias AssetType = ImageAsset + +public struct ImageAsset { + public fileprivate(set) var name: String + + public var image: Image { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + let image = Image(named: name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + let image = bundle.image(forResource: NSImage.Name(name)) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { fatalError("Unable to load image named \(name).") } + return result + } +} + +public struct ColorAsset { + public fileprivate(set) var name: String + + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + public var color: AssetColorTypeAlias { + return AssetColorTypeAlias(asset: self) + } +} + +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +public enum Asset { + public enum Colors { + public enum _24Vision { + public static let background = ColorAsset(name: "24Vision/Background") + public static let primary = ColorAsset(name: "24Vision/Primary") + } + public static let orange = ImageAsset(name: "Orange") + public enum Vengo { + public static let primary = ColorAsset(name: "Vengo/Primary") + public static let tint = ColorAsset(name: "Vengo/Tint") + } + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + _24Vision.background, + _24Vision.primary, + Vengo.primary, + Vengo.tint, + ] + public static let allImages: [ImageAsset] = [ + orange, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } + public enum Images { + public enum Exotic { + public static let banana = ImageAsset(name: "Exotic/Banana") + public static let mango = ImageAsset(name: "Exotic/Mango") + } + public enum Round { + public static let apricot = ImageAsset(name: "Round/Apricot") + public enum Red { + public static let apple = ImageAsset(name: "Round/Apple") + public enum Double { + public static let cherry = ImageAsset(name: "Round/Double/Cherry") + } + public static let tomato = ImageAsset(name: "Round/Tomato") + } + } + public static let `private` = ImageAsset(name: "private") + + // swiftlint:disable trailing_comma + public static let allColors: [ColorAsset] = [ + ] + public static let allImages: [ImageAsset] = [ + Exotic.banana, + Exotic.mango, + Round.apricot, + Round.Red.apple, + Round.Red.Double.cherry, + Round.Red.tomato, + `private`, + ] + // swiftlint:enable trailing_comma + @available(*, deprecated, renamed: "allImages") + public static let allValues: [AssetType] = allImages + } +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +public extension Image { + @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) + @available(OSX, deprecated, + message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") + convenience init!(asset: ImageAsset) { + #if os(iOS) || os(tvOS) + let bundle = Bundle(for: BundleToken.self) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + self.init(named: NSImage.Name(asset.name)) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +public extension AssetColorTypeAlias { + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + convenience init!(asset: ColorAsset) { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + self.init(named: NSColor.Name(asset.name), bundle: bundle) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +private final class BundleToken {} diff --git a/Tests/TemplatesTests/ColorsTests.swift b/Tests/TemplatesTests/ColorsTests.swift index 3204b96..da5c9f5 100644 --- a/Tests/TemplatesTests/ColorsTests.swift +++ b/Tests/TemplatesTests/ColorsTests.swift @@ -23,7 +23,10 @@ class ColorsTests: XCTestCase { (context: try StencilContext.enrich(context: context, parameters: ["enumName=\(customName)", "colorAliasName=XCTColor"]), - suffix: "-customname") + suffix: "-customname"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } } diff --git a/Tests/TemplatesTests/FontsTests.swift b/Tests/TemplatesTests/FontsTests.swift index 9858a36..9a8e9d3 100644 --- a/Tests/TemplatesTests/FontsTests.swift +++ b/Tests/TemplatesTests/FontsTests.swift @@ -26,7 +26,10 @@ class FontsTests: XCTestCase { suffix: "-customname"), (context: try StencilContext.enrich(context: context, parameters: ["preservePath"]), - suffix: "-preservepath") + suffix: "-preservepath"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } diff --git a/Tests/TemplatesTests/StoryboardsMacOSTests.swift b/Tests/TemplatesTests/StoryboardsMacOSTests.swift index 475d49b..a75b5ce 100644 --- a/Tests/TemplatesTests/StoryboardsMacOSTests.swift +++ b/Tests/TemplatesTests/StoryboardsMacOSTests.swift @@ -50,7 +50,10 @@ class StoryboardsMacOSTests: XCTestCase { suffix: ""), (context: try StencilContext.enrich(context: context, parameters: ["module=PrefsWindowController", "ignoreTargetModule"]), - suffix: "-ignore-module-need-extra-definitions") + suffix: "-ignore-module-need-extra-definitions"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } diff --git a/Tests/TemplatesTests/StoryboardsiOSTests.swift b/Tests/TemplatesTests/StoryboardsiOSTests.swift index fcc7ffc..707653c 100644 --- a/Tests/TemplatesTests/StoryboardsiOSTests.swift +++ b/Tests/TemplatesTests/StoryboardsiOSTests.swift @@ -50,7 +50,10 @@ class StoryboardsiOSTests: XCTestCase { suffix: ""), (context: try StencilContext.enrich(context: context, parameters: ["module=SlackTextViewController", "ignoreTargetModule"]), - suffix: "-ignore-module-need-extra-definitions") + suffix: "-ignore-module-need-extra-definitions"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } diff --git a/Tests/TemplatesTests/StringsTests.swift b/Tests/TemplatesTests/StringsTests.swift index 1be2a70..7192c77 100644 --- a/Tests/TemplatesTests/StringsTests.swift +++ b/Tests/TemplatesTests/StringsTests.swift @@ -24,7 +24,10 @@ class StringsTests: XCTestCase { suffix: "-customname"), (context: try StencilContext.enrich(context: context, parameters: ["noComments"]), - suffix: "-no-comments") + suffix: "-no-comments"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } diff --git a/Tests/TemplatesTests/XCAssetsTests.swift b/Tests/TemplatesTests/XCAssetsTests.swift index 9cb0a01..7c4fb2d 100644 --- a/Tests/TemplatesTests/XCAssetsTests.swift +++ b/Tests/TemplatesTests/XCAssetsTests.swift @@ -28,7 +28,10 @@ class XCAssetsTests: XCTestCase { suffix: "-customname"), (context: try StencilContext.enrich(context: context, parameters: ["noAllValues"]), - suffix: "-no-all-values") + suffix: "-no-all-values"), + (context: try StencilContext.enrich(context: context, + parameters: ["publicAccess"]), + suffix: "-publicAccess") ] } From 83167f670d290ed075659ce4499ada4dc78ae58d Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Wed, 1 Nov 2017 21:20:24 +0100 Subject: [PATCH 7/8] Use public classes in stubs when using "*-publicAccess" fixtures --- Fixtures/stub-env/PublicDefinitions.swift | 15 +++++++++++++++ Rakefile | 13 +++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 Fixtures/stub-env/PublicDefinitions.swift diff --git a/Fixtures/stub-env/PublicDefinitions.swift b/Fixtures/stub-env/PublicDefinitions.swift new file mode 100644 index 0000000..d47edb1 --- /dev/null +++ b/Fixtures/stub-env/PublicDefinitions.swift @@ -0,0 +1,15 @@ +#if os(iOS) + import UIKit + + public class CreateAccViewController: UIViewController { + } + public class XXPickerViewController: UIViewController { + } +#elseif os(OSX) + import Cocoa + + public class CustomTabViewController: NSWindowController { + } + public class NSControllerPlaceholder: NSWindowController { + } +#endif diff --git a/Rakefile b/Rakefile index a880d89..4c262d3 100755 --- a/Rakefile +++ b/Rakefile @@ -125,15 +125,16 @@ namespace :output do end sdks = sdks(f) - definitions = if f.include?('extra-definitions') - %("#{MODULE_OUTPUT_PATH}/Definitions.swift" "#{MODULE_OUTPUT_PATH}/ExtraDefinitions.swift") - else - definitions = %("#{MODULE_OUTPUT_PATH}/Definitions.swift") - end + if f.include?('publicAccess') + defs = ["#{MODULE_OUTPUT_PATH}/PublicDefinitions.swift"] + else + defs = ["#{MODULE_OUTPUT_PATH}/Definitions.swift"] + end + defs << "#{MODULE_OUTPUT_PATH}/ExtraDefinitions.swift" if f.include?('extra-definitions') commands = sdks.map do |sdk| %(--toolchain #{toolchain[:toolchain]} -sdk #{sdk} swiftc -swift-version #{toolchain[:version]} ) + - %(-typecheck -target #{SDKS[sdk]} -I #{toolchain[:module_path]} #{definitions} #{f}) + %(-typecheck -target #{SDKS[sdk]} -I #{toolchain[:module_path]} #{defs.join(' ')} #{f}) end subtask = File.basename(f, '.*') From f17dc0a84dd4468614586adb9a936d901e506791 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Wed, 1 Nov 2017 21:48:01 +0100 Subject: [PATCH 8/8] =?UTF-8?q?Run=20rubocop=20=F0=9F=A4=96=20on=20the=20R?= =?UTF-8?q?akefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 25 +++++++++++++++++++++++++ Gemfile | 1 + Gemfile.lock | 17 +++++++++++++++++ Rakefile | 12 ++++++------ 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..c859360 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,25 @@ +AllCops: + Exclude: + - SwiftGenKit/Tests/Resources/**/* + - SwiftGen/Resources/**/* + +Style/HashSyntax: + Enabled: false + +Lint/RescueWithoutErrorClass: + Enabled: false + +Metrics/AbcSize: + Max: 24 + +Metrics/BlockLength: + Enabled: false + +Metrics/LineLength: + Max: 140 + +Metrics/MethodLength: + Max: 30 + +Metrics/ClassLength: + Max: 120 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 2ddba99..c51c987 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,5 @@ source 'https://rubygems.org' gem 'cocoapods', '~> 1.3' gem 'octokit', '~> 4.7' gem 'rake', '~> 10.4' +gem 'rubocop', '~> 0.51' gem 'xcpretty' diff --git a/Gemfile.lock b/Gemfile.lock index 55f8016..51ea077 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,7 @@ GEM tzinfo (~> 1.1) addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) + ast (2.3.0) claide (1.0.2) cocoapods (1.3.1) activesupport (>= 4.0.2, < 5) @@ -59,16 +60,31 @@ GEM netrc (0.7.8) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) + parallel (1.12.0) + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) public_suffix (2.0.5) + rainbow (2.2.2) + rake rake (10.5.0) rouge (2.0.7) + rubocop (0.51.0) + parallel (~> 1.10) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) ruby-macho (1.1.0) + ruby-progressbar (1.9.0) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) thread_safe (0.3.6) tzinfo (1.2.3) thread_safe (~> 0.1) + unicode-display_width (1.3.0) xcodeproj (1.5.1) CFPropertyList (~> 2.3.3) claide (>= 1.0.2, < 2.0) @@ -84,6 +100,7 @@ DEPENDENCIES cocoapods (~> 1.3) octokit (~> 4.7) rake (~> 10.4) + rubocop (~> 0.51) xcpretty BUNDLED WITH diff --git a/Rakefile b/Rakefile index 4c262d3..cd5cd8e 100755 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ require 'English' WORKSPACE = 'Templates'.freeze SCHEME_NAME = 'Tests'.freeze CONFIGURATION = 'Debug'.freeze -MIN_XCODE_VERSION = '~> 9.0' +MIN_XCODE_VERSION = '~> 9.0'.freeze ## [ Output compilation ] ##################################################### @@ -125,11 +125,11 @@ namespace :output do end sdks = sdks(f) - if f.include?('publicAccess') - defs = ["#{MODULE_OUTPUT_PATH}/PublicDefinitions.swift"] - else - defs = ["#{MODULE_OUTPUT_PATH}/Definitions.swift"] - end + defs = if f.include?('publicAccess') + ["#{MODULE_OUTPUT_PATH}/PublicDefinitions.swift"] + else + defs = ["#{MODULE_OUTPUT_PATH}/Definitions.swift"] + end defs << "#{MODULE_OUTPUT_PATH}/ExtraDefinitions.swift" if f.include?('extra-definitions') commands = sdks.map do |sdk|