diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 40f9f95..8f11599 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -19,7 +19,7 @@ 2660AE64C9E410A25C2843C36234176F /* SPKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D6E74D42802BED80BA5A8B40D487EB /* SPKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26716A741AF7BA466B6A94D7D02708F1 /* BModules.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD33F2569E31ACFE5F1A9CBC7ED16A2 /* BModules.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29D6E7BFC80D699725A224EA138BD470 /* SP+CGRect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5135023804A6655EE61C420E5E7EEE05 /* SP+CGRect.swift */; }; - 2C3D234BB20731DBEDA62E65883A1016 /* Routable+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+String.swift */; }; + 2C3D234BB20731DBEDA62E65883A1016 /* Routable+help.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+help.swift */; }; 2E1E64BC2190D8B910963CC632E4B528 /* Pods-Routable_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2599630A0A06F419913BA5A12B805D3D /* Pods-Routable_Example-dummy.m */; }; 3148EBB311B7545F796F186CF55744FE /* BModules-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B947178A2F59A9D6D56C7A636A53F3 /* BModules-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 352C14237666129EBF267AFEBA301B5F /* Routable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F4FE2144F0540AE26AEC4E668158269 /* Routable.swift */; }; @@ -293,7 +293,7 @@ F196FAB97CDBC4F5EB9B607C5F4BB0F5 /* Router_objc.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = Router_objc.m; path = SourcesA/Router_objc.m; sourceTree = ""; }; F1B55DA42940E62A6A14BF4F9CF7C021 /* SPRoutable.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = SPRoutable.modulemap; sourceTree = ""; }; F201BD227149C02114D08D1B00107FF8 /* SPKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SPKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+String.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Routable+String.swift"; path = "Sources/Routable+String.swift"; sourceTree = ""; }; + F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+help.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Routable+help.swift"; path = "Sources/Routable+help.swift"; sourceTree = ""; }; F4C4E914F0408F0AC5A381F2A31D602F /* BModules.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; path = BModules.podspec; sourceTree = ""; }; F505F4F1538EB007409A357CC93FFC5C /* SP+UIColor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SP+UIColor.swift"; path = "Sources/SP+UIColor.swift"; sourceTree = ""; }; F5D8971AFE7BE7A33A2E1D5EFBEB87C5 /* Router_objc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Router_objc.h; path = SourcesA/Router_objc.h; sourceTree = ""; }; @@ -567,7 +567,7 @@ children = ( 7A39924145E4CE0B7C840464E072EC12 /* Routable.h */, 4F4FE2144F0540AE26AEC4E668158269 /* Routable.swift */, - F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+String.swift */, + F4C3943422EBC3C8928FF78B1FF7D8A7 /* Routable+help.swift */, 6AD7DA8632C8091D0DB634914BD0B321 /* URLProtocol.swift */, 1CEA42F8F783DFDDDDB3B04AE2E6E7D5 /* Pod */, B41B51E41C4045B89962048A2BE19FF5 /* Support Files */, @@ -966,7 +966,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2C3D234BB20731DBEDA62E65883A1016 /* Routable+String.swift in Sources */, + 2C3D234BB20731DBEDA62E65883A1016 /* Routable+help.swift in Sources */, 352C14237666129EBF267AFEBA301B5F /* Routable.swift in Sources */, 1F512188DDF4EF2AFA6AC5C22FD4DF2D /* SPRoutable-dummy.m in Sources */, FE3BCD691114D06DA9EDC6F5F973D60B /* URLProtocol.swift in Sources */, diff --git a/Example/Routable.xcodeproj/project.pbxproj b/Example/Routable.xcodeproj/project.pbxproj index ce94c6d..c082169 100644 --- a/Example/Routable.xcodeproj/project.pbxproj +++ b/Example/Routable.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 7600C3EC86201FBE2F488EC4 /* Pods_Routable_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7A1A607D848D1067BAEC435 /* Pods_Routable_Example.framework */; }; 9D4AFF4F1F62B33B00CB7AFF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D4AFF4E1F62B33B00CB7AFF /* Main.storyboard */; }; + CDC77629201B02DD00D1E90B /* trunk.sh in Resources */ = {isa = PBXBuildFile; fileRef = CDC77628201B02DD00D1E90B /* trunk.sh */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -29,10 +30,11 @@ 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 61552B9935F64C22E757429D /* Pods-Routable_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Routable_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Routable_Example/Pods-Routable_Example.debug.xcconfig"; sourceTree = ""; }; 62EF8BF05C23CE2BE276B3CB /* Pods-Routable_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Routable_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Routable_Example/Pods-Routable_Example.release.xcconfig"; sourceTree = ""; }; - 9D3908501F6391A600539CDD /* AModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = AModules.podspec; path = ../AModules.podspec; sourceTree = ""; }; + 9D3908501F6391A600539CDD /* AModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = AModules.podspec; path = ../AModules.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9D3908591F63978800539CDD /* Routable_Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Routable_Example-Bridging-Header.h"; sourceTree = ""; }; 9D39085D1F639DB800539CDD /* BModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = BModules.podspec; path = ../BModules.podspec; sourceTree = ""; }; 9D4AFF4E1F62B33B00CB7AFF /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + CDC77628201B02DD00D1E90B /* trunk.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = trunk.sh; path = ../trunk.sh; sourceTree = ""; }; D708ABE3D23B10173268732B /* SPRoutable.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SPRoutable.podspec; path = ../SPRoutable.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; F7A1A607D848D1067BAEC435 /* Pods_Routable_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Routable_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -114,6 +116,7 @@ 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { isa = PBXGroup; children = ( + CDC77628201B02DD00D1E90B /* trunk.sh */, 9D3908501F6391A600539CDD /* AModules.podspec */, 9D39085D1F639DB800539CDD /* BModules.podspec */, D708ABE3D23B10173268732B /* SPRoutable.podspec */, @@ -187,6 +190,7 @@ buildActionMask = 2147483647; files = ( 9D4AFF4F1F62B33B00CB7AFF /* Main.storyboard in Resources */, + CDC77629201B02DD00D1E90B /* trunk.sh in Resources */, 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, ); diff --git a/SPRoutable.podspec b/SPRoutable.podspec index bc5c8be..652f281 100644 --- a/SPRoutable.podspec +++ b/SPRoutable.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SPRoutable' -s.version = '0.8.2' +s.version = '0.8.3' s.summary = '基础的路由服务' diff --git a/Sources/Routable+String.swift b/Sources/Routable+help.swift similarity index 54% rename from Sources/Routable+String.swift rename to Sources/Routable+help.swift index dbe0596..1155ba6 100644 --- a/Sources/Routable+String.swift +++ b/Sources/Routable+help.swift @@ -39,30 +39,16 @@ struct RoutableHelp { /// 格式化为Json /// /// - Returns: Json字符串 - static func formatJSON(dict: [String: Any]) -> String { - guard JSONSerialization.isValidJSONObject(dict) else { return "{}" } + static func formatJSON(data: Any) -> String { + guard JSONSerialization.isValidJSONObject(data) else { return String(describing: data) } do { - let jsonData = try JSONSerialization.data(withJSONObject: dict, options: JSONSerialization.WritingOptions(rawValue: 0)) - return String(data: jsonData, encoding: .utf8) ?? "{}" + let json = try JSONSerialization.data(withJSONObject: data, options: JSONSerialization.WritingOptions(rawValue: 0)) + return String(data: json, encoding: .utf8) ?? String(describing: data) } catch { - return "{}" + return String(describing: data) } } - /// 格式化为Json - /// - /// - Returns: Json字符串 - static func formatJSON(array: [Any]) -> String { - guard JSONSerialization.isValidJSONObject(array) else { return "{}" } - do { - let jsonData = try JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions(rawValue: 0)) - return String(data: jsonData, encoding: .utf8) ?? "{}" - } catch { - return "{}" - } - } - - } diff --git a/Sources/Routable.swift b/Sources/Routable.swift index 5d18d42..7d5a5c6 100644 --- a/Sources/Routable.swift +++ b/Sources/Routable.swift @@ -53,9 +53,9 @@ public extension Routable { case let v as String: return URLQueryItem(name: item.key, value: v) case let v as [String:Any]: - return URLQueryItem(name: item.key, value: RoutableHelp.formatJSON(dict: v)) + return URLQueryItem(name: item.key, value: RoutableHelp.formatJSON(data: v)) case let v as [Any]: - return URLQueryItem(name: item.key, value: RoutableHelp.formatJSON(array: v)) + return URLQueryItem(name: item.key, value: RoutableHelp.formatJSON(data: v)) default: return URLQueryItem(name: item.key, value: String(describing: item.value)) } diff --git a/trunk.sh b/trunk.sh index b460ce7..8dd1b69 100644 --- a/trunk.sh +++ b/trunk.sh @@ -1,6 +1,4 @@ #! /bin/bash -#value=$(