Skip to content

Commit

Permalink
macOS support is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan Shahbazi authored and Hassan Shahbazi committed Jul 10, 2018
1 parent 7de7e47 commit e570af8
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 36 deletions.
6 changes: 3 additions & 3 deletions CBORSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ Pod::Spec.new do |s|
#

# s.platform = :ios
s.platform = :ios, "10.0"
# s.platform = :ios, "10.0"

# When using multiple platforms
# s.ios.deployment_target = "10.13"
# s.osx.deployment_target = "10.7"
s.ios.deployment_target = "10.0"
s.osx.deployment_target = "10.12"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"

Expand Down
12 changes: 4 additions & 8 deletions CBORSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
1747B8C0209C5BA9000663CA /* Decoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1747B8BF209C5BA9000663CA /* Decoder.swift */; };
179837AB209A1A2E0048DCD2 /* CBORSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 179837A1209A1A2E0048DCD2 /* CBORSwift.framework */; };
179837B0209A1A2E0048DCD2 /* CBORSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179837AF209A1A2E0048DCD2 /* CBORSwiftTests.swift */; };
179837B2209A1A2E0048DCD2 /* CBORSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 179837A4209A1A2E0048DCD2 /* CBORSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
179837BC209A1CAD0048DCD2 /* MajorTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179837BB209A1CAD0048DCD2 /* MajorTypes.swift */; };
179837BF209A22310048DCD2 /* CBOR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179837BE209A22310048DCD2 /* CBOR.swift */; };
179837C1209A2A490048DCD2 /* Encoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179837C0209A2A490048DCD2 /* Encoder.swift */; };
Expand All @@ -35,7 +34,6 @@
1747B8BD209C5B8F000663CA /* CBORDecoderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CBORDecoderTests.swift; sourceTree = "<group>"; };
1747B8BF209C5BA9000663CA /* Decoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decoder.swift; sourceTree = "<group>"; };
179837A1209A1A2E0048DCD2 /* CBORSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CBORSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
179837A4209A1A2E0048DCD2 /* CBORSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBORSwift.h; sourceTree = "<group>"; };
179837A5209A1A2E0048DCD2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
179837AA209A1A2E0048DCD2 /* CBORSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CBORSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
179837AF209A1A2E0048DCD2 /* CBORSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CBORSwiftTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -88,7 +86,6 @@
isa = PBXGroup;
children = (
179837BD209A1CB30048DCD2 /* Classes */,
179837A4209A1A2E0048DCD2 /* CBORSwift.h */,
179837A5209A1A2E0048DCD2 /* Info.plist */,
);
path = CBORSwift;
Expand Down Expand Up @@ -125,7 +122,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
179837B2209A1A2E0048DCD2 /* CBORSwift.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -397,7 +393,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.hassaniiii.CBORSwift;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand Down Expand Up @@ -426,7 +422,7 @@
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.hassaniiii.CBORSwift;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -449,7 +445,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hassaniiii.CBORSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -471,7 +467,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hassaniiii.CBORSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
ReferencedContainer = "container:CBORSwift.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "CBORDecoderTests/test_2_decodeMap()">
</Test>
<Test
Identifier = "CBORSwiftTests/test_2_generalDecode()">
</Test>
Expand Down
19 changes: 0 additions & 19 deletions CBORSwift/CBORSwift.h

This file was deleted.

2 changes: 2 additions & 0 deletions CBORSwift/Classes/CBOR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2018 Hassan Shahbazi. All rights reserved.
//

import Foundation

public class CBOR: NSObject {

//MARK:- Encoder
Expand Down
2 changes: 2 additions & 0 deletions CBORSwift/Classes/Decoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2018 Hassan Shahbazi. All rights reserved.
//

import Foundation

class Decoder: NSObject {
private var body = [UInt8]()

Expand Down
2 changes: 2 additions & 0 deletions CBORSwift/Classes/Encoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2018 Hassan Shahbazi. All rights reserved.
//

import Foundation

class Encoder: NSObject {
class func prepareByteArray(major: MajorType, measure: Int) -> [UInt8] {
var encoded = MajorTypes(major).get().bytes
Expand Down
3 changes: 3 additions & 0 deletions CBORSwift/Classes/MajorTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// Created by Hassan Shahbazi on 5/2/18.
// Copyright © 2018 Hassan Shahbazi. All rights reserved.
//

import Foundation

enum MajorType: String {
case major0 = "000" //unsigned integer
case major1 = "001" //negative integer
Expand Down
2 changes: 1 addition & 1 deletion CBORSwift/Classes/MyNSObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2018 Hassan Shahbazi. All rights reserved.
//

import UIKit
import Foundation

public class NSByteString: NSObject {
private var value: String = ""
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var encoded = NSNumber(value: -42949295).encode()
var decoded = CBOR.decode([0x0A])
var decoded = [0x0A].decode()

var decoded = CBOR.decode([[0x39, 0x01, 0x00]])
var decoded = [[0x39, 0x01, 0x00]].decode()
var decoded = CBOR.decode([0x39, 0x01, 0x00])
var decoded = [0x39, 0x01, 0x00].decode()
```

#### Byte Strings
Expand Down

0 comments on commit e570af8

Please sign in to comment.