Skip to content

Commit

Permalink
Add ContextMaker and bridging header for fix CIContext init(options:)…
Browse files Browse the repository at this point in the history
… and bump version to 2.3.1
  • Loading branch information
yeahdongcn committed Nov 23, 2016
1 parent e6c760d commit 8f13828
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Simply add the following lines to your `Podfile`:
# required by Cocoapods 0.36.0.rc.1 for Swift Pods
use_frameworks!

pod 'RSBarcodes_Swift', '~> 0.1.9'
pod 'RSBarcodes_Swift', '~> 2.3.1'
```

Need to import RSBarcodes_Swift manually in the ViewController file after creating the file using wizard.
Expand All @@ -56,7 +56,7 @@ Need to import RSBarcodes_Swift manually in the ViewController file after creati
Simply add the following line to your `Cartfile`:

```ruby
github "yeahdongcn/RSBarcodes_Swift" >= 0.1.9
github "yeahdongcn/RSBarcodes_Swift" >= 2.3.1
```

Need to import RSBarcodes_Swift manually in the ViewController file after creating the file using wizard.
Expand Down
19 changes: 18 additions & 1 deletion RSBarcodes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
56E348A11DE59B9F00C8E343 /* ContextMaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 56E3489E1DE59B9F00C8E343 /* ContextMaker.h */; };
56E348A21DE59B9F00C8E343 /* ContextMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = 56E3489F1DE59B9F00C8E343 /* ContextMaker.m */; };
56E348A31DE59B9F00C8E343 /* RSBarcodes-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 56E348A01DE59B9F00C8E343 /* RSBarcodes-Bridging-Header.h */; };
D08336CA1A209AAB004EE128 /* RSCode39Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08336B91A209AAB004EE128 /* RSCode39Generator.swift */; };
D08336CB1A209AAB004EE128 /* RSCode39Mod43Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08336BA1A209AAB004EE128 /* RSCode39Mod43Generator.swift */; };
D08336CC1A209AAB004EE128 /* RSCode93Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08336BB1A209AAB004EE128 /* RSCode93Generator.swift */; };
Expand All @@ -29,6 +32,9 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
56E3489E1DE59B9F00C8E343 /* ContextMaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContextMaker.h; path = Source/ContextMaker.h; sourceTree = SOURCE_ROOT; };
56E3489F1DE59B9F00C8E343 /* ContextMaker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ContextMaker.m; path = Source/ContextMaker.m; sourceTree = SOURCE_ROOT; };
56E348A01DE59B9F00C8E343 /* RSBarcodes-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "RSBarcodes-Bridging-Header.h"; path = "Source/RSBarcodes-Bridging-Header.h"; sourceTree = SOURCE_ROOT; };
D08336371A202E81004EE128 /* RSBarcodes.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RSBarcodes.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D08336B81A209AA0004EE128 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Source/Info.plist; sourceTree = SOURCE_ROOT; };
D08336B91A209AAB004EE128 /* RSCode39Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RSCode39Generator.swift; path = Source/RSCode39Generator.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -82,6 +88,9 @@
D08336391A202E81004EE128 /* RSBarcodes */ = {
isa = PBXGroup;
children = (
56E3489E1DE59B9F00C8E343 /* ContextMaker.h */,
56E3489F1DE59B9F00C8E343 /* ContextMaker.m */,
56E348A01DE59B9F00C8E343 /* RSBarcodes-Bridging-Header.h */,
D08336BD1A209AAB004EE128 /* RSCodeGenerator.swift */,
E71A74271C914B0C0081B389 /* RSUnifiedCodeValidator.swift */,
D08336C61A209AAB004EE128 /* RSUnifiedCodeGenerator.swift */,
Expand Down Expand Up @@ -121,6 +130,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
56E348A11DE59B9F00C8E343 /* ContextMaker.h in Headers */,
56E348A31DE59B9F00C8E343 /* RSBarcodes-Bridging-Header.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -157,7 +168,7 @@
TargetAttributes = {
D08336361A202E81004EE128 = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0810;
};
};
};
Expand Down Expand Up @@ -193,6 +204,7 @@
D08336D71A209AAB004EE128 /* RSUnifiedCodeGenerator.swift in Sources */,
D08336CD1A209AAB004EE128 /* RSCode128Generator.swift in Sources */,
E71A74281C914B0C0081B389 /* RSUnifiedCodeValidator.swift in Sources */,
56E348A21DE59B9F00C8E343 /* ContextMaker.m in Sources */,
D08336CF1A209AAB004EE128 /* RSCodeLayer.swift in Sources */,
D08336D51A209AAB004EE128 /* RSITF14Generator.swift in Sources */,
D08336D01A209AAB004EE128 /* RSCodeReaderViewController.swift in Sources */,
Expand Down Expand Up @@ -251,6 +263,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Source/RSBarcodes-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -293,6 +306,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Source/RSBarcodes-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -304,6 +318,7 @@
D083364E1A202E81004EE128 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -315,13 +330,15 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.pdq.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
D083364F1A202E81004EE128 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand Down
4 changes: 2 additions & 2 deletions RSBarcodes_Swift.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "RSBarcodes_Swift"
s.version = "0.1.9"
s.version = "2.3.1"
s.summary = "1D and 2D barcodes reader and generators for iOS 8 with delightful controls. Now Swift. "
s.homepage = "https://github.com/yeahdongcn/RSBarcodes_Swift"
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.author = { "R0CKSTAR" => "yeahdongcn@gmail.com" }
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.com/yeahdongcn/RSBarcodes_Swift.git', :tag => "#{s.version}" }
s.source_files = 'Source/*.swift'
s.source_files = 'Source/*.{swift,h,m}'
s.frameworks = ['CoreImage', 'AVFoundation', 'QuartzCore']
s.requires_arc = true
end
17 changes: 17 additions & 0 deletions Source/ContextMaker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ContextMaker.h
// RSBarcodes
//
// Created by R0CKSTAR on 11/23/16.
// Copyright (c) 2016 P.D.Q. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreImage/CoreImage.h>

// http://stackoverflow.com/questions/39939415/cicontext-initwithoptions-unrecognized-selector-sent-to-instance
@interface ContextMaker : NSObject

+ (CIContext *)make;

@end
18 changes: 18 additions & 0 deletions Source/ContextMaker.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ContextMaker.m
// RSBarcodes
//
// Created by R0CKSTAR on 11/23/16.
// Copyright (c) 2016 P.D.Q. All rights reserved.
//

#import "ContextMaker.h"

@implementation ContextMaker

+ (CIContext*) make
{
return [CIContext contextWithOptions:nil];
}

@end
14 changes: 14 additions & 0 deletions Source/RSBarcodes-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// RSBarcodes-Bridging-Header.h
// RSBarcodes
//
// Created by R0CKSTAR on 11/23/16.
// Copyright (c) 2016 P.D.Q. All rights reserved.
//

#ifndef RSBarcodes_Bridging_Header_h
#define RSBarcodes_Bridging_Header_h

#import "ContextMaker.h"

#endif /* RSBarcodes_Bridging_Header_h */
2 changes: 1 addition & 1 deletion Source/RSCodeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public class RSAbstractCodeGenerator : RSCodeGenerator {
}

let outputImage = filter.outputImage
let context = CIContext(options: nil)
let context = ContextMaker.make()
if let outputImage = outputImage {
let cgImage = context.createCGImage(outputImage, fromRect: outputImage.extent)
return UIImage(CGImage: cgImage!, scale: 1, orientation: UIImageOrientation.Up)
Expand Down

0 comments on commit 8f13828

Please sign in to comment.