Skip to content

Commit

Permalink
Cleanup file comments, re-indent some files
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlokhorst committed Dec 9, 2022
1 parent 0acf36e commit b2eddb7
Show file tree
Hide file tree
Showing 49 changed files with 63 additions and 147 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// RswiftGenerateResourcesCommand.swift
//
// R.swift
//
// Created by Tom Lokhorst on 2022-10-19.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// RswiftModifyXcodePackages.swift
//
// R.swift
//
// Created by Tom Lokhorst on 2022-11-07.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Foundation
import RswiftResources

private protocol AccessibilityIdentifierContainer {
var name: String { get }
var usedAccessibilityIdentifiers: [String] { get }
var name: String { get }
var usedAccessibilityIdentifiers: [String] { get }
}

extension NibResource: AccessibilityIdentifierContainer {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Tom Lokhorst on 2017-06-06.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand All @@ -31,4 +29,3 @@ struct AssetCatalogMergedNamespaces {
}
}
}

3 changes: 0 additions & 3 deletions Sources/RswiftGenerators/Shared/SwiftIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 11-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down Expand Up @@ -165,4 +163,3 @@ private let SwiftKeywords = [
// Keywords from Swift 2 that are still reserved
"__COLUMN__", "__FILE__", "__FUNCTION__", "__LINE__",
]

2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/AssetCatalog+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
10 changes: 4 additions & 6 deletions Sources/RswiftParsers/Resources/FileResource+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand All @@ -13,10 +11,10 @@ import RswiftResources
extension FileResource {
// These are all extensions of resources that are passed to some special compiler step and not directly available at runtime
static public let unsupportedExtensions: Set<String> = [
AssetCatalog.supportedExtensions,
StringsTable.supportedExtensions,
NibResource.supportedExtensions,
StoryboardResource.supportedExtensions,
AssetCatalog.supportedExtensions,
StringsTable.supportedExtensions,
NibResource.supportedExtensions,
StoryboardResource.supportedExtensions,
]
.reduce([]) { $0.union($1) }

Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/FontResource+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/ImageResource+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/Nib+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
8 changes: 3 additions & 5 deletions Sources/RswiftParsers/Resources/PropertyList+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Tom Lokhorst on 2018-07-08.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand All @@ -13,10 +11,10 @@ import RswiftResources
extension PropertyListResource {
static public func parse(url: URL, buildConfigurationName: String) throws -> PropertyListResource {
guard
let nsDictionary = NSDictionary(contentsOf: url),
let dictionary = nsDictionary as? [String: Any]
let nsDictionary = NSDictionary(contentsOf: url),
let dictionary = nsDictionary as? [String: Any]
else {
throw ResourceParsingError("File could not be parsed as InfoPlist from URL: \(url.absoluteString)")
throw ResourceParsingError("File could not be parsed as InfoPlist from URL: \(url.absoluteString)")
}

return PropertyListResource(buildConfigurationName: buildConfigurationName, contents: dictionary, url: url)
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/Storyboard+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Resources/StringsTable+Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Tom Lokhorst on 2016-04-24.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Shared/FormatPart+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Tom Lokhorst on 2016-04-18.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//
// Parts of the content of this file are loosly based on StringsFileParser.swift from SwiftGen/GenumKit.
// We don't feel this is a "substantial portion of the Software" so are not including their MIT license,
Expand Down
2 changes: 1 addition & 1 deletion Sources/RswiftParsers/Shared/GeneratedId.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GeneratedId.swift
//
// R.swift
//
// Created by Tom Lokhorst on 2022-07-15.
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/RswiftParsers/Shared/ResourceParsingError.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ResourceParsingError.swift
// RswiftCore
// R.swift
//
// Created by Tom Lokhorst on 2021-04-16.
//
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftParsers/Shared/SupportedExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 10-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
3 changes: 1 addition & 2 deletions Sources/RswiftParsers/Shared/Xcodeproj.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//
// Xcodeproj.swift
// RswiftCore
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
21 changes: 6 additions & 15 deletions Sources/RswiftResources/FileResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,27 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation

public struct FileResource {

// public let filename: String
public let name: String
public let pathExtension: String
public let bundle: Bundle
public let locale: LocaleReference?
//
// public init(filename: String, bundle: Bundle?, locale: LocaleReference?) {
// self.filename = filename
// self.bundle = bundle
// self.locale = locale
// }

public var filename: String {
name.isEmpty || pathExtension.isEmpty
? "\(name)\(pathExtension)"
: "\(name).\(pathExtension)"
}

public init(name: String, pathExtension: String, bundle: Bundle, locale: LocaleReference?) {
self.name = name
self.pathExtension = pathExtension
self.bundle = bundle
self.locale = locale
}

public var filename: String {
name.isEmpty || pathExtension.isEmpty
? "\(name)\(pathExtension)"
: "\(name).\(pathExtension)"
}
}
2 changes: 0 additions & 2 deletions Sources/RswiftResources/FontResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions Sources/RswiftResources/ImageResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// R.swift
//
// Created by Mathijs Kadijk on 09-12-15.
// From: https://github.com/mac-cain13/R.swift
// License: MIT License
//

import Foundation
Expand Down
6 changes: 3 additions & 3 deletions Sources/RswiftResources/Integrations/Bundle+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Bundle+Extensions.swift
//
// R.swift
//
// Created by Tom Lokhorst on 2022-07-30.
//
Expand All @@ -13,8 +13,8 @@ extension Bundle {
public func infoDictionaryString(path: [String], key: String) -> String? {
var dict = infoDictionary
for step in path {
guard let obj = dict?[step] as? [String: Any] else { return nil }
dict = obj
guard let obj = dict?[step] as? [String: Any] else { return nil }
dict = obj
}
return dict?[key] as? String
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//
// UIColor+ColorResource.swift
// R.swift.Library
// R.swift
//
// Created by Tom Lokhorst on 2017-06-06.
// From: https://github.com/mac-cain13/R.swift.Library
// License: MIT License
//

import Foundation
Expand Down Expand Up @@ -37,7 +35,7 @@ extension ColorResource {

- returns: A color that exactly or best matches the desired traits with the given resource (`R.color.*`), or nil if no suitable color was found.
*/
// @available(*, deprecated, message: "Use UIColor(resource:) initializer instead")
// @available(*, deprecated, message: "Use UIColor(resource:) initializer instead")
public func callAsFunction(compatibleWith traitCollection: UITraitCollection? = nil) -> UIColor? {
UIColor(named: name, in: bundle, compatibleWith: traitCollection)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//
// Bundle+FileResource.swift
// R.swift.Library
// R.swift
//
// Created by Mathijs Kadijk on 10-01-16.
// From: https://github.com/mac-cain13/R.swift.Library
// License: MIT License
//

import Foundation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//
// UIFont+FontResource.swift
// R.swift.Library
// R.swift
//
// Created by Mathijs Kadijk on 06-01-16.
// From: https://github.com/mac-cain13/R.swift.Library
// License: MIT License
//

import Foundation
Expand Down Expand Up @@ -38,7 +36,6 @@ extension Font {
}
}


#if canImport(UIKit)
import UIKit

Expand All @@ -52,24 +49,24 @@ extension FontResource {

- returns: A color that exactly or best matches the desired traits with the given resource (R.color.\*), or nil if no suitable color was found.
*/
// @available(*, deprecated, message: "Use UIFont(resource:size:) initializer instead")
// @available(*, deprecated, message: "Use UIFont(resource:size:) initializer instead")
public func callAsFunction(size: CGFloat) -> UIFont? {
UIFont(name: name, size: size)
}
}

public extension UIFont {
/**
Creates and returns a font object for the specified font resource (`R.font.*`) and size.
/**
Creates and returns a font object for the specified font resource (`R.font.*`) and size.

- parameter resource: The font resource (`R.font.*`) for the specific font to load
- parameter size: The size (in points) to which the font is scaled. This value must be greater than 0.0.
- parameter resource: The font resource (`R.font.*`) for the specific font to load
- parameter size: The size (in points) to which the font is scaled. This value must be greater than 0.0.

- returns: A font object of the specified font resource and size.
*/
convenience init?(resource: FontResource, size: CGFloat) {
self.init(name: resource.name, size: size)
}
- returns: A font object of the specified font resource and size.
*/
convenience init?(resource: FontResource, size: CGFloat) {
self.init(name: resource.name, size: size)
}
}
#endif

Expand Down
Loading

0 comments on commit b2eddb7

Please sign in to comment.