-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve support for configuring SPM Xcode projects (#253)
Current support for Swift Package Manager is a bit rough for both Xcode project and package manifest setups, and we lack clear guidance for the latter in the README. Since Swift Package Manager is gaining popularity in the iOS ecosystem, it makes sense to streamline our integration and bring it up to parity with CocoaPods and Carthage. - Make configured build phase portable between machines by rewriting paths in derived data - Remove dependency on pcregrep in SwiftPM quick start guide - Add ability to specify output directory in generate command
- Loading branch information
1 parent
b4f671d
commit 8ee3e4d
Showing
6 changed files
with
154 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// String+Regex.swift | ||
// MockingbirdCli | ||
// | ||
// Created by typealias on 12/25/21. | ||
// | ||
|
||
import Foundation | ||
|
||
extension String { | ||
/// Returns all matches and capture groups given a regex pattern. First element is the full match. | ||
func components(matching pattern: String) -> [[Substring]] { | ||
guard let regex = try? NSRegularExpression(pattern: pattern) else { return [] } | ||
return regex | ||
.matches(in: self, range: NSMakeRange(0, count)) | ||
.map({ result -> [Substring] in | ||
return (0..<result.numberOfRanges) | ||
.map({ index -> NSRange in result.range(at: index) }) | ||
.filter({ range -> Bool in range.location != NSNotFound }) | ||
.compactMap({ range -> Range<Index>? in Range(range, in: self) }) | ||
.map({ range -> Substring in self[range] }) | ||
}) | ||
} | ||
} |