Skip to content

Commit

Permalink
加了参数为集合类型的支持.
Browse files Browse the repository at this point in the history
  • Loading branch information
linhay committed Jan 26, 2018
1 parent 7a97f20 commit 3587c8a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 30 deletions.
8 changes: 4 additions & 4 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Example/Routable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -29,10 +30,11 @@
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
9D3908501F6391A600539CDD /* AModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = AModules.podspec; path = ../AModules.podspec; sourceTree = "<group>"; };
9D3908501F6391A600539CDD /* AModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = AModules.podspec; path = ../AModules.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9D3908591F63978800539CDD /* Routable_Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Routable_Example-Bridging-Header.h"; sourceTree = "<group>"; };
9D39085D1F639DB800539CDD /* BModules.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = BModules.podspec; path = ../BModules.podspec; sourceTree = "<group>"; };
9D4AFF4E1F62B33B00CB7AFF /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
CDC77628201B02DD00D1E90B /* trunk.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = trunk.sh; path = ../trunk.sh; sourceTree = "<group>"; };
D708ABE3D23B10173268732B /* SPRoutable.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SPRoutable.podspec; path = ../SPRoutable.podspec; sourceTree = "<group>"; 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 */
Expand Down Expand Up @@ -114,6 +116,7 @@
607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
isa = PBXGroup;
children = (
CDC77628201B02DD00D1E90B /* trunk.sh */,
9D3908501F6391A600539CDD /* AModules.podspec */,
9D39085D1F639DB800539CDD /* BModules.podspec */,
D708ABE3D23B10173268732B /* SPRoutable.podspec */,
Expand Down Expand Up @@ -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 */,
);
Expand Down
2 changes: 1 addition & 1 deletion SPRoutable.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SPRoutable'
s.version = '0.8.2'
s.version = '0.8.3'
s.summary = '基础的路由服务'


Expand Down
24 changes: 5 additions & 19 deletions Sources/Routable+String.swift → Sources/Routable+help.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 "{}"
}
}


}


4 changes: 2 additions & 2 deletions Sources/Routable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
4 changes: 1 addition & 3 deletions trunk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#! /bin/bash
#value=$(<uppod.sh)
#echo "$value"

# value=./*.podspec
file="SPRoutable.podspec" #${value##*/}
Expand All @@ -23,4 +21,4 @@ if [ -z ${diff} ];then
fi
git tag -a ${version} -m ${diff}
git push origin ${version}
pod trunk push ${file}
pod trunk push ${file}

0 comments on commit 3587c8a

Please sign in to comment.