Skip to content

Commit

Permalink
cocoapods release 1.0-alpha fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikans committed Jan 20, 2020
1 parent 35f735e commit 4c80529
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Example/MonarchRouterExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
17958E51AD3E4032D5A6C478 /* Pods_MonarchRouter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CF23C904D963434DC0360A9D /* Pods_MonarchRouter.framework */; };
9187C6D64BB2763E78C00E8D /* Pods_MonarchRouterExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1907EB298DF999B25DA1BB67 /* Pods_MonarchRouterExample.framework */; };
D03164B7237B8C9300F9B1EC /* Route.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03164B6237B8C9300F9B1EC /* Route.swift */; };
D03164B9237BA5D300F9B1EC /* String+extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03164B8237BA5D300F9B1EC /* String+extension.swift */; };
D03164BB237E1C3A00F9B1EC /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03164BA237E1C3A00F9B1EC /* Request.swift */; };
D07E7B0C21A5606F00B415D6 /* State.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07E7B0B21A5606F00B415D6 /* State.swift */; };
D09228CC235B4AB30066E33B /* AppRoutes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09228CB235B4AB30066E33B /* AppRoutes.swift */; };
Expand All @@ -32,6 +31,7 @@
D0A7BA12219F378B00B44C3D /* Presenters.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A7BA11219F378B00B44C3D /* Presenters.swift */; };
D0A7BA14219F3C5900B44C3D /* EndpointBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A7BA13219F3C5800B44C3D /* EndpointBuilder.swift */; };
D0A7BA16219F3EC500B44C3D /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A7BA15219F3EC500B44C3D /* AppCoordinator.swift */; };
D0D1F2E223D5CF2C00EFB61F /* String+extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D1F2E123D5CF2C00EFB61F /* String+extension.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -66,7 +66,6 @@
9E40EA1D4799DD2D0F3A8810 /* Pods-MonarchRouterExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MonarchRouterExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MonarchRouterExample/Pods-MonarchRouterExample.debug.xcconfig"; sourceTree = "<group>"; };
CF23C904D963434DC0360A9D /* Pods_MonarchRouter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MonarchRouter.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D03164B6237B8C9300F9B1EC /* Route.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Route.swift; path = ../../Source/Route.swift; sourceTree = "<group>"; };
D03164B8237BA5D300F9B1EC /* String+extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+extension.swift"; sourceTree = "<group>"; };
D03164BA237E1C3A00F9B1EC /* Request.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Request.swift; path = ../../Source/Request.swift; sourceTree = "<group>"; };
D07E7B0B21A5606F00B415D6 /* State.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = State.swift; path = ../../Source/State.swift; sourceTree = "<group>"; };
D09228CB235B4AB30066E33B /* AppRoutes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRoutes.swift; sourceTree = "<group>"; };
Expand All @@ -90,6 +89,7 @@
D0A7BA11219F378B00B44C3D /* Presenters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presenters.swift; sourceTree = "<group>"; };
D0A7BA13219F3C5800B44C3D /* EndpointBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EndpointBuilder.swift; sourceTree = "<group>"; };
D0A7BA15219F3EC500B44C3D /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = "<group>"; };
D0D1F2E123D5CF2C00EFB61F /* String+extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+extension.swift"; path = "../../Source/String+extension.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -183,7 +183,7 @@
D09D0DF021A4703100601258 /* PresenterFork.swift */,
D09D0DF221A470C300601258 /* PresenterSwitcher.swift */,
D0A7BA0B219F363900B44C3D /* Collection+extension.swift */,
D03164B8237BA5D300F9B1EC /* String+extension.swift */,
D0D1F2E123D5CF2C00EFB61F /* String+extension.swift */,
D0A7B9EC219F324200B44C3D /* MonarchRouter.h */,
D0A7B9ED219F324200B44C3D /* Info.plist */,
);
Expand Down Expand Up @@ -382,9 +382,9 @@
D03164B7237B8C9300F9B1EC /* Route.swift in Sources */,
D09D0DF321A470C300601258 /* PresenterSwitcher.swift in Sources */,
D09D0DEF21A46FE300601258 /* PresenterStack.swift in Sources */,
D0D1F2E223D5CF2C00EFB61F /* String+extension.swift in Sources */,
D03164BB237E1C3A00F9B1EC /* Request.swift in Sources */,
D09D0DF121A4703100601258 /* PresenterFork.swift in Sources */,
D03164B9237BA5D300F9B1EC /* String+extension.swift in Sources */,
D0A7BA10219F363900B44C3D /* Node.swift in Sources */,
D09228D2235B5CFC0066E33B /* Parameters.swift in Sources */,
D0A7BA0E219F363900B44C3D /* Collection+extension.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "original"
}
}
16 changes: 8 additions & 8 deletions Example/MonarchRouterExample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="2He-Z9-tZI">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="2He-Z9-tZI">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15508"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -102,7 +102,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="jyI-w6-5tD" firstAttribute="leading" secondItem="T1x-jM-0hD" secondAttribute="leading" id="FD6-DR-CjG"/>
<constraint firstItem="gKb-F6-TK4" firstAttribute="top" secondItem="jyI-w6-5tD" secondAttribute="bottom" id="Uac-A2-936"/>
Expand Down Expand Up @@ -173,7 +173,7 @@
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="DOM-oP-sr4" firstAttribute="leading" secondItem="PAh-Re-tMA" secondAttribute="leading" id="KJQ-cE-toZ"/>
<constraint firstItem="DOM-oP-sr4" firstAttribute="top" secondItem="PAh-Re-tMA" secondAttribute="top" id="Quc-yX-UND"/>
Expand Down Expand Up @@ -252,7 +252,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="gOR-1R-ewS" firstAttribute="centerX" secondItem="CQh-DS-IRz" secondAttribute="centerX" id="8tP-Mb-JYa"/>
<constraint firstItem="F9j-Bw-WTp" firstAttribute="top" secondItem="CQh-DS-IRz" secondAttribute="top" id="AbZ-K5-vgP"/>
Expand Down Expand Up @@ -331,7 +331,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="Kns-bC-tfW" secondAttribute="trailing" id="Djh-vw-9h3"/>
<constraint firstAttribute="bottom" secondItem="fGg-LX-JGf" secondAttribute="bottom" id="EXR-Pb-tbk"/>
Expand Down Expand Up @@ -399,7 +399,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="kkG-sU-K1i" secondAttribute="trailing" id="1E0-TA-H4i"/>
<constraint firstItem="kkG-sU-K1i" firstAttribute="top" secondItem="Qfr-gh-uqi" secondAttribute="top" id="5C8-Jn-mqp"/>
Expand Down Expand Up @@ -462,7 +462,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="5Xv-P2-bwX" secondAttribute="trailing" id="5wv-C1-91D"/>
<constraint firstAttribute="bottom" secondItem="5Xv-P2-bwX" secondAttribute="bottom" id="Fea-OS-kgK"/>
Expand Down
2 changes: 1 addition & 1 deletion Source/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension URL: RoutingRequestType
public func resolve(for route: RouteType) -> RoutingResolvedRequestType
{
let pathComponents: [PathComponentType] = self.pathComponents.enumerated().map { (i, pathComponent) in
if route.components.count > i, case .parameter(let name, let parameterType, _) = route.components[i] {
if route.components.count > i, case .parameter(let name, _, _) = route.components[i] {
return PathParameter(name, pathComponent)
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Route.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum RouteComponent
guard let pathComponent = pathComponent as? PathConstant else { return false }
return pathComponent.name == name

case .parameter(let name, let parameterType, let isMatching):
case .parameter(let name, _ /*let parameterType*/, let isMatching):
// path component is not a parameter
guard let pathComponent = pathComponent as? PathParameterType
else { return false }
Expand Down
47 changes: 47 additions & 0 deletions Source/String+extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// String+extension.swift
// MonarchRouter
//
// Created by Eliah Snakin on 13.11.2019.
// Copyright © 2019 nikans.com. All rights reserved.
//

import Foundation



// A set of operations for parametrized routes handling.
extension String
{
/// Returns whether a String matches a given regex.
func matches(_ regex: String) -> Bool {
return self.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil
}

/// Returns substrings captured by regex groups.
func capturedGroups(withRegex pattern: String) -> [String] {
var results = [String]()

var regex: NSRegularExpression
do {
regex = try NSRegularExpression(pattern: pattern, options: [])
} catch {
return results
}

let matches = regex.matches(in: self, options: [], range: NSRange(location:0, length: count))

guard let match = matches.first else { return results }

let lastRangeIndex = match.numberOfRanges - 1
guard lastRangeIndex >= 1 else { return results }

for i in 1...lastRangeIndex {
let capturedGroupIndex = match.range(at: i)
let matchedString = (self as NSString).substring(with: capturedGroupIndex)
results.append(matchedString)
}

return results
}
}

0 comments on commit 4c80529

Please sign in to comment.