diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..1b9a063 Binary files /dev/null and b/.DS_Store differ diff --git a/.swift-version b/.swift-version index 9f55b2c..5186d07 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 +4.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ff0be3..0520f91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,23 @@ ## CHANGELOG +* Version **[1.0.0](#100)** * Version **[0.9.0](#090)** + + +## SwiftMsgPack 1.0.0 +--- +- **Release Date**: 2017/09/14 +- **Zipped Version**: [Download 1.0.0](https://github.com/malcommac/SwiftMsgPack/releases/tag/1.0.0) + +Swift 4 compatible version + + + ## SwiftMsgPack 0.9.0 --- - **Release Date**: 2017/02/26 - **Zipped Version**: [Download 0.9.0](https://github.com/malcommac/SwiftMsgPack/releases/tag/0.9.0) -First release \ No newline at end of file +First release diff --git a/README.md b/README.md index 77f0d52..75ffe2b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ Take a look here: ## Current Release -Latest release is: 0.9.1 [Download here](https://github.com/malcommac/SwiftMsgPack/releases/tag/0.9.1). +* **Swift 4.x**: Latest is 1.0.0 [Download here](https://github.com/malcommac/SwiftMsgPack/releases/tag/1.0.0). +* **Swift 3.x**: Last is 0.9.1 [Download here](https://github.com/malcommac/SwiftMsgPack/releases/tag/0.9.1). + A complete list of changes for each release is available in the [CHANGELOG](CHANGELOG.md) file. @@ -136,7 +138,7 @@ Tests can also be runned with XCode using the SwiftMsgPack project. Current version is compatible with: -* Swift 3.0+ +* Swift 4.x+ (Swift 3.x up to 0.9.1) * iOS 9.0 or later * tvOS 9.0 or later * macOS 10.10 or later diff --git a/Sources/SwiftMsgPack/Decoder.swift b/Sources/SwiftMsgPack/Decoder.swift index a20decd..826acb7 100644 --- a/Sources/SwiftMsgPack/Decoder.swift +++ b/Sources/SwiftMsgPack/Decoder.swift @@ -297,10 +297,10 @@ public extension Data { // STRING 32 BIT LENGTH // str 32 11011011 0xdb case 0xdb: - let len_data = Int(try stream.read8Bit()) << 24 + - Int(try stream.read8Bit()) << 16 + - Int(try stream.read8Bit()) << 8 + - Int(try stream.read8Bit()) + var len_data = Int(try stream.read8Bit()) << 24 + len_data += Int(try stream.read8Bit()) << 16 + len_data += Int(try stream.read8Bit()) << 8 + len_data += Int(try stream.read8Bit()) return try unpack(string: &stream, length: len_data) @@ -346,7 +346,6 @@ public extension Data { guard let key = try self.unpack(stream: &stream) as? AnyHashable else { throw MsgPackError.unsupportedValue("Invalid dict key") } - print(key) let val = try self.unpack(stream: &stream) dict[key] = val } diff --git a/Sources/SwiftMsgPack/Encoder.swift b/Sources/SwiftMsgPack/Encoder.swift index 5ca8d29..a54003b 100644 --- a/Sources/SwiftMsgPack/Encoder.swift +++ b/Sources/SwiftMsgPack/Encoder.swift @@ -380,7 +380,7 @@ public extension Data { @discardableResult private mutating func pack(array value: [Any?]) throws -> Data { - guard value.count < Int(bitPattern: UInt(UInt32.max)) else { + guard UInt32(bitPattern: Int32(value.count)) < UInt32.max else { //guard value.count < Int(UInt32.max) else { // Array is too large to be included in a MsgPack data throw MsgPackError.dataIsTooBig("Array is too big: \(value.count) items") @@ -405,7 +405,7 @@ public extension Data { @discardableResult private mutating func pack(dict value: [AnyHashable:Any?]) throws -> Data { - guard value.count < Int(bitPattern: UInt(UInt32.max)) else { + guard UInt32(bitPattern: Int32(value.count)) < UInt32.max else { // guard value.count < Int(UInt32.max) else { // Dictionary is too large to be contained in a MsgPack data throw MsgPackError.dataIsTooBig("Dictionary is too big: \(value.count) items") diff --git a/SwiftMsgPack.podspec b/SwiftMsgPack.podspec index 19fdc85..26b05c3 100644 --- a/SwiftMsgPack.podspec +++ b/SwiftMsgPack.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'SwiftMsgPack' - spec.version = '0.9.1' + spec.version = '1.0.0' spec.summary = 'MsgPack Encoder/Decoder in pure Swift' spec.homepage = 'https://github.com/malcommac/SwiftMsgPack' spec.license = { :type => 'MIT', :file => 'LICENSE' } @@ -8,9 +8,9 @@ Pod::Spec.new do |spec| spec.social_media_url = 'http://twitter.com/danielemargutti' spec.source = { :git => 'https://github.com/malcommac/SwiftMsgPack.git', :tag => "#{spec.version}" } spec.source_files = 'Sources/**/*.swift' - spec.ios.deployment_target = '9.0' + spec.ios.deployment_target = '8.0' spec.osx.deployment_target = '10.10' spec.tvos.deployment_target = '9.0' spec.requires_arc = true spec.module_name = 'SwiftMsgPack' -end \ No newline at end of file +end diff --git a/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.pbxproj b/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.pbxproj index f90c798..0c1e398 100644 --- a/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.pbxproj +++ b/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.pbxproj @@ -309,6 +309,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -354,6 +355,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -382,7 +384,7 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -407,7 +409,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; @@ -423,7 +425,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mokasw.SwiftMsgPackTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -437,7 +439,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mokasw.SwiftMsgPackTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.xcworkspace/xcuserdata/dan.xcuserdatad/UserInterfaceState.xcuserstate b/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.xcworkspace/xcuserdata/dan.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2c3cbe9 Binary files /dev/null and b/SwiftMsgPack/SwiftMsgPack.xcodeproj/project.xcworkspace/xcuserdata/dan.xcuserdatad/UserInterfaceState.xcuserstate differ