Skip to content
This repository was archived by the owner on May 20, 2021. It is now read-only.

Commit d6b953b

Browse files
authored
Merge pull request #35 from darthpelo/master
Use globally NSRegularExpression to avoid build error on Linux
2 parents b5ed292 + c39f2f5 commit d6b953b

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Sources/Wrap.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public extension WrapCustomizable {
261261
public extension WrapCustomizable {
262262
/// Convert a given property name (assumed to be camelCased) to snake_case
263263
func convertPropertyNameToSnakeCase(propertyName: String) -> String {
264-
let regex = try! RegularExpression(pattern: "(?<=[a-z])([A-Z])|([A-Z])(?=[a-z])", options: [])
264+
let regex = try! NSRegularExpression(pattern: "(?<=[a-z])([A-Z])|([A-Z])(?=[a-z])", options: [])
265265
let range = NSRange(location: 0, length: propertyName.characters.count)
266266
let camelCasePropertyName = regex.stringByReplacingMatches(in: propertyName, options: [], range: range, withTemplate: "_$1$2")
267267
return camelCasePropertyName.lowercased()
@@ -566,10 +566,3 @@ extension Optional : WrapOptional {
566566
}
567567
}
568568
}
569-
570-
571-
// MARK: - Cross platform compatibility
572-
573-
#if !os(Linux)
574-
private typealias RegularExpression = NSRegularExpression
575-
#endif

0 commit comments

Comments
 (0)