From 0bac5e32efd888ec47747f94ce324fbe6a3f22d0 Mon Sep 17 00:00:00 2001 From: Helge Hess Date: Wed, 25 Mar 2015 17:10:26 +0100 Subject: [PATCH 1/2] Updated for Swift v0.2 (UInt=>Int, split) --- SwiftyExpat/Expat.swift | 4 ++-- SwiftyExpat/SwiftExtensions.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SwiftyExpat/Expat.swift b/SwiftyExpat/Expat.swift index 59c444a..e00f934 100644 --- a/SwiftyExpat/Expat.swift +++ b/SwiftyExpat/Expat.swift @@ -215,7 +215,7 @@ public extension Expat { // Namespaces { let sep = self.nsSeparator // so that we don't capture 'self' (necessary?) return onStartElement { - let comps = split($0, { $0 == sep }, maxSplit: 1, allowEmptySlices: false) + let comps = split($0, maxSplit: 1, allowEmptySlices: false) { $0 == sep } cb(comps[0], comps[1], $1) } } @@ -223,7 +223,7 @@ public extension Expat { // Namespaces public func onEndElementNS(cb: ( String, String ) -> Void) -> Self { let sep = self.nsSeparator // so that we don't capture 'self' (necessary?) return onEndElement { - let comps = split($0, { $0 == sep }, maxSplit: 1, allowEmptySlices: false) + let comps = split($0, maxSplit: 1, allowEmptySlices: false) { $0 == sep } cb(comps[0], comps[1]) } } diff --git a/SwiftyExpat/SwiftExtensions.swift b/SwiftyExpat/SwiftExtensions.swift index a51485d..fc1d450 100644 --- a/SwiftyExpat/SwiftExtensions.swift +++ b/SwiftyExpat/SwiftExtensions.swift @@ -13,7 +13,7 @@ // Hack to compare values if we don't have access to the members of the struct, // eg XML_Error in v0.0.4 public func isByteEqual(var lhs: T, var rhs: T) -> Bool { - return memcmp(&lhs, &rhs, UInt(sizeof(T))) == 0 + return memcmp(&lhs, &rhs, sizeof(T)) == 0 } extension String { @@ -27,7 +27,7 @@ extension String { let buflen = length + 1 var buf = UnsafeMutablePointer.alloc(buflen) - memcpy(buf, cs, UInt(length)) + memcpy(buf, cs, length) buf[length] = 0 // zero terminate let s = String.fromCString(buf) buf.dealloc(buflen) From 3ea3add5fd8e3b2b65fb0b8daba03c77fc457f40 Mon Sep 17 00:00:00 2001 From: Helge Hess Date: Wed, 25 Mar 2015 17:11:49 +0100 Subject: [PATCH 2/2] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be6dcba..5e8e4fd 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,13 @@ blocks instead of function pointer callbacks. ###Targets +Updated to use Swift v0.2.3 (aka Xcode 6.3 beta). + The project includes two targets: - SwiftyExpat - SwiftyExpatTests -I suggest you start out looking at the SwiftyExpatTests. +I suggest you start by looking at the SwiftyExpatTests. ####SwiftyExpat