Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,10 @@ jobs:
with:
ref: ${{github.ref}}

- name: Build the ZXingCpp.xcframework
- name: Build the swift package
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios
run: ./build-release.sh

- name: Upload .xcframework
uses: actions/upload-artifact@v3
with:
name: ios-artifacts
path: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios/ZXingCpp.xcframework
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}
run: swift build

- name: Build the demo app
shell: sh
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ CMakeLists.txt.user
*.d
*.a
compile_commands.json
.swiftpm
.build
20 changes: 11 additions & 9 deletions wrappers/ios/Package.swift → Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.7.1
import PackageDescription

let package = Package(
Expand All @@ -9,23 +9,25 @@ let package = Package(
products: [
.library(
name: "ZXingCppWrapper",
type: .static,
targets: ["ZXingCppWrapper"])
],
targets: [
.binaryTarget(
.target(
name: "ZXingCpp",
path: "ZXingCpp.xcframework"
path: "core/src",
publicHeadersPath: "."
),
.target(
name: "ZXingCppWrapper",
dependencies: ["ZXingCpp"],
path: "Sources/Wrapper",
path: "wrappers/ios/Sources/Wrapper",
publicHeadersPath: ".",
cxxSettings: [
.unsafeFlags(["-stdlib=libc++"]),
.unsafeFlags(["-std=gnu++17"])
linkerSettings: [
.linkedFramework("CoreGraphics"),
.linkedFramework("CoreImage"),
.linkedFramework("CoreVideo")
]
)
]
],
cxxLanguageStandard: CXXLanguageStandard.gnucxx20
)
19 changes: 0 additions & 19 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -482,25 +482,6 @@ endif()

set_target_properties(ZXing PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")

if (APPLE AND BUILD_APPLE_FRAMEWORK)
set_target_properties(ZXing PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION "C"
XCODE_ATTRIBUTE_DEFINES_MODULE YES
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES
XCODE_ATTRIBUTE_MODULEMAP_FILE "wrappers/ios/Sources/Wrapper/module.modulemap"
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
MACOSX_FRAMEWORK_IDENTIFIER "com.zxing-cpp.ios"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO
#MACOSX_FRAMEWORK_INFO_PLIST Info.plist
PUBLIC_HEADER "${PUBLIC_HEADERS}"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
XCODE_ATTRIBUTE_ENABLE_BITCODE "NO"
)
endif()

include (GNUInstallDirs)

set(ZX_INSTALL_TARGETS ZXing)
Expand Down
4 changes: 0 additions & 4 deletions wrappers/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
.swiftpm
_builds
.build
xcuserdata
ZXingCpp.xcframework
Binary file removed wrappers/ios/Info.plist
Binary file not shown.
13 changes: 1 addition & 12 deletions wrappers/ios/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# ZXingCpp iOS Framework

To use the iOS (wrapper) framework in other apps, it is easiest
to build the library project and include the resulting xcframework
file in your app.

## How to build and use

To build the xcframework:

$ ./build-release.sh

Then you can add the iOS Wrapper as a local Swift Package by adding it as a dependency to your app.
Don't forget to add the wrapper to the `Frameworks, Libraries, and Embedded Content` section within the `General` tab.
Add the iOS wrapper either as a local Swift Package by adding it as a dependency to your app or add the repository, the Package.swift file is automatically picked.
6 changes: 3 additions & 3 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIBarcodeReader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: Apache-2.0

#import "ZXIBarcodeReader.h"
#import "ZXing/ReadBarcode.h"
#import "ZXing/ImageView.h"
#import "ZXing/Result.h"
#import "ReadBarcode.h"
#import "ImageView.h"
#import "Result.h"
#import "ZXIFormatHelper.h"
#import "ZXIPosition+Helper.h"

Expand Down
2 changes: 1 addition & 1 deletion wrappers/ios/Sources/Wrapper/Reader/ZXIDecodeHints.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#import "ZXIDecodeHints.h"
#import "ZXing/DecodeHints.h"
#import "DecodeHints.h"

@interface ZXIDecodeHints()
@property(nonatomic) ZXing::DecodeHints zxingHints;
Expand Down
2 changes: 1 addition & 1 deletion wrappers/ios/Sources/Wrapper/Reader/ZXIPosition+Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import <Foundation/Foundation.h>
#import "ZXIPosition.h"
#import "ZXing/Result.h"
#import "Result.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
4 changes: 2 additions & 2 deletions wrappers/ios/Sources/Wrapper/Writer/ZXIBarcodeWriter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#import <CoreGraphics/CoreGraphics.h>
#import "ZXIBarcodeWriter.h"
#import "ZXing/MultiFormatWriter.h"
#import "ZXing/BitMatrix.h"
#import "MultiFormatWriter.h"
#import "BitMatrix.h"
#import "ZXIFormatHelper.h"
#import "ZXIErrors.h"
#import <iostream>
Expand Down
2 changes: 1 addition & 1 deletion wrappers/ios/Sources/Wrapper/ZXIFormatHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#import <Foundation/Foundation.h>
#import "ZXing/BarcodeFormat.h"
#import "BarcodeFormat.h"
#import "ZXIFormat.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down
37 changes: 0 additions & 37 deletions wrappers/ios/build-release.sh

This file was deleted.

2 changes: 0 additions & 2 deletions wrappers/ios/demo/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# ZXingWrapper Demo Project

This demo-project sets up a basic `AVCaptureSession` and uses ZXing on the incoming frames.
You have to build the `ZXing.xcframework` before, by performing the `build-release.sh` script
in the parent-directory.
42 changes: 32 additions & 10 deletions wrappers/ios/demo/demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,23 @@
388BF030283CC49D005CE271 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 388BF02E283CC49D005CE271 /* Main.storyboard */; };
388BF032283CC49E005CE271 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 388BF031283CC49E005CE271 /* Assets.xcassets */; };
388BF035283CC49E005CE271 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 388BF033283CC49E005CE271 /* LaunchScreen.storyboard */; };
9507445028609C0500E02D06 /* ZXingCppWrapper in Frameworks */ = {isa = PBXBuildFile; productRef = 9507444F28609C0500E02D06 /* ZXingCppWrapper */; };
5EFA4B742ADF0F35000132A0 /* ZXingCppWrapper in Frameworks */ = {isa = PBXBuildFile; productRef = 5EFA4B732ADF0F35000132A0 /* ZXingCppWrapper */; };
950744522860A3A300E02D06 /* WriteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950744512860A3A300E02D06 /* WriteViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
52A975482ADAD7DE002D6BD8 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
388BF025283CC49D005CE271 /* demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
388BF028283CC49D005CE271 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -27,16 +40,16 @@
388BF034283CC49E005CE271 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
388BF036283CC49E005CE271 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
388BF043283CE0AC005CE271 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
5EFA4B712ADF0F16000132A0 /* zxing-cpp */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "zxing-cpp"; path = ../../..; sourceTree = "<group>"; };
950744512860A3A300E02D06 /* WriteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteViewController.swift; sourceTree = "<group>"; };
9550105328609B7900ED103F /* ios */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = ios; path = ..; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
388BF022283CC49D005CE271 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9507445028609C0500E02D06 /* ZXingCppWrapper in Frameworks */,
5EFA4B742ADF0F35000132A0 /* ZXingCppWrapper in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -46,11 +59,11 @@
388BF01C283CC49D005CE271 = {
isa = PBXGroup;
children = (
5EFA4B702ADF0F16000132A0 /* Packages */,
388BF043283CE0AC005CE271 /* README.md */,
388BF03E283CD6C5005CE271 /* Packages */,
388BF027283CC49D005CE271 /* demo */,
388BF026283CC49D005CE271 /* Products */,
388BF040283CD908005CE271 /* Frameworks */,
5EFA4B722ADF0F35000132A0 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -77,15 +90,15 @@
path = demo;
sourceTree = "<group>";
};
388BF03E283CD6C5005CE271 /* Packages */ = {
5EFA4B702ADF0F16000132A0 /* Packages */ = {
isa = PBXGroup;
children = (
9550105328609B7900ED103F /* ios */,
5EFA4B712ADF0F16000132A0 /* zxing-cpp */,
);
name = Packages;
sourceTree = "<group>";
};
388BF040283CD908005CE271 /* Frameworks */ = {
5EFA4B722ADF0F35000132A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
Expand All @@ -102,14 +115,15 @@
388BF021283CC49D005CE271 /* Sources */,
388BF022283CC49D005CE271 /* Frameworks */,
388BF023283CC49D005CE271 /* Resources */,
52A975482ADAD7DE002D6BD8 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = demo;
packageProductDependencies = (
9507444F28609C0500E02D06 /* ZXingCppWrapper */,
5EFA4B732ADF0F35000132A0 /* ZXingCppWrapper */,
);
productName = demo;
productReference = 388BF025283CC49D005CE271 /* demo.app */;
Expand Down Expand Up @@ -139,6 +153,8 @@
Base,
);
mainGroup = 388BF01C283CC49D005CE271;
packageReferences = (
);
productRefGroup = 388BF026283CC49D005CE271 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -314,6 +330,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
Expand All @@ -326,13 +343,15 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing-cpp.ios.demo-${SAMPLE_CODE_DISAMBIGUATOR}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SAMPLE_CODE_DISAMBIGUATOR = "${DEVELOPMENT_TEAM}";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Expand All @@ -345,6 +364,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
Expand All @@ -357,13 +377,15 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing-cpp.ios.demo-${SAMPLE_CODE_DISAMBIGUATOR}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SAMPLE_CODE_DISAMBIGUATOR = "${DEVELOPMENT_TEAM}";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -395,7 +417,7 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
9507444F28609C0500E02D06 /* ZXingCppWrapper */ = {
5EFA4B732ADF0F35000132A0 /* ZXingCppWrapper */ = {
isa = XCSwiftPackageProductDependency;
productName = ZXingCppWrapper;
};
Expand Down
Loading