A convenient class usable from UIKit view controller or SwiftUI to scan document & get UIImage or PDFDocument as result - Replacement of IRLDocumentScanner

Last update: Jun 21, 2022

IRLPDFScanContent

Super easy SwiftUI & UKKit pakcage to scan: Images or PDF. It is also a replacement for IRLScannerViewController

🍎 Documentation Quality Gate Status Version Platform Carthage compatible licence MIT

Overview

A convenient class usable from UIKit view controller or SwiftUI to scan document & get UIImage or PDFDocument as result

MINIMUM iOS REQUIREMENT: 13.0

Migration from IRLScannerViewController

Migration from IRLScannerViewController is feasible. Please check the tutorial available in the documentation.

You project should still work with depreciation warnings

Follow the tutorial to see how to beneficiate from the new system & remove the depreciation warnings.

One quick note, the new system support multiple scan. In this tutorial we cover how to get 1 scan. It is very straigth forward to get eveything else, check the doc.

Application plist requirement

As of iOS 10, you must povide a reason for using the camera in you Info.plist: Please add the following to your plist: NSCameraUsageDescription : We need the camera to scan

Install

Swift Package

Integrate the library via Swift Package (With Documentation)

In Xcode

Add the Package to your project, min version 5.5, See Apple Documentation for more details.

Manually

Create a Package.swift in a folder, then Drop the file on Xcode

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
    name: "SPMDemo",
    products: [
        .library(
            name: "SPMDemo",
            targets: ["SPMDemo"]),
    ],
    dependencies: [
       .package(url: "[email protected]:charlymr/IRLPDFScanContent.git", from: "1.1.0"),
    ],
    targets: [
        .target( name: "SPMDemo",
            dependencies: [
                .product(name: "IRLPDFScanContent", package: "IRLPDFScanContent"),
        ])
    ]
)

CocoaPods

Integrate the library via CocoaPods

Install CocoaPods

if not already available:

$ [sudo] gem install cocoapods
$ pod setup

Update your Podfile

Change to the directory of your Xcode project, and Create and Edit your Podfile and add IRLPDFScanContent:

$ cd /path/to/MyProject
$ touch Podfile
## edit Podfile:

platform :ios, '13.0'

target "YOUR APP" do
    pod 'IRLPDFScanContent'
    use_frameworks!
end

Prepare project

run pod update or pod install to generate the Workspace

$ pod update

Carthage

Integrate the library via Carthage. For more details on Cartage and how to use it, check the Carthage Github documentation

Install Carthage

Install Carthage if not already available

Update your CartFile

Change to the directory of your Xcode project, and Create and Edit your CartFile and add IRLPDFScanContent:

1.1.0 ">
$ cd /path/to/MyProject
$ touch CartFile
## edit CartFile:

github "charlymr/IRLPDFScanContent" ~> 1.1.0

Prepare

$ carthage update --use-xcframeworks 

Drop the Carthage/Build/iOS .xcframework in your project.

Getting started

IRLPDFScanContent is a convenient way to use PDFKit in SwiftUI allowing the user to scan multiple pages and create a PDF for you. This tutorials will guides you through adding this functionality to a SwiftUI view or a UIVIewController. You will learn to build the view and hanlde the user input.

Chech the documentation (Essentials / Getting Started) here: Documentation for more details.

SwiftUI example

  • Initiate the object
  • present you view present(animated:)
  • Observe the result of latestScan
  • Use the convenient method swiftUIPDFView to update your view
import SwiftUI
import IRLPDFScanContent

struct ContentView: View {
    
    @ObservedObject var scanner: IRLPDFScanContent = IRLPDFScanContent()
        
    var body: some View {
        NavigationView {
            VStack() {
                 if let latestScan = scanner.latestScan {
                    latestScan.swiftUIPDFView
                    
                } else {
                    Text("Press the Scan button")
                }
            }
            .padding()
            .navigationBarItems(trailing: Button("Scan", action: {
                scanner.present(animated: true, completion: nil)
            }))
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Authors

Open Source

  • Feel free to fork and modify this code. Pull requests are more than welcome!

MIT License

Copyright (c) 2021 MARTIN-BRUILLOT Denis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

GitHub

https://github.com/charlymr/IRLPDFScanContent
You might also like...

Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.

Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.

PassportScanner Works with 2 and 3 line identity documents. What is this With PassportScanner you can use your camera to scan the MRZ code of a passpo

Apr 17, 2022

You will learn how to scan QR code with iOS framework.

You will learn how to scan QR code with iOS framework.

QR Code Scanner You will learn how to scan QR code with in iOS without using any library. It is as simple to scan QR code in iOS. In this example, We

Oct 25, 2021

🔍BarcodeScanner – simple & easy application that helps you to scan both EAN8 and EAN13 barcodes.

🔍BarcodeScanner – simple & easy application that helps you to scan both EAN8 and EAN13 barcodes.

🔍 Simple & easy application that helps you to scan both EAN8 and EAN13 barcodes.

Apr 22, 2022

A swift SDK to help you scan debit/credit cards.

SKCardReader A swift SDK to help you scan debit/credit cards. Requirements To use the SDK the following requirements must be met: Xcode 11.0 or newer

Oct 1, 2021

When you scan the clothing tag, a 3D character appears and informs you of the clothing information.

When you scan the clothing tag, a 3D character appears and informs you of the clothing information.

1. Introduction When you scan the clothing tag, a 3D character appears and tells you the information on the clothes. You can select necessary informat

Dec 23, 2021

KYC-iOS-Native - To Scan Doc and Validate KYC

KYC-iOS-Native Example To run the example project, clone the repo, and run pod i

Jan 10, 2022

ScanID - Homework iOS project to scan IDs MRZ code

ScanID Homework iOS project to scan IDs MRZ code Requirements for mobile applica

Jan 28, 2022

A Simple iOS QR code scanner that allows users to enable their camera and local Photo Library accesses to scan the contents of the input QR codes.

iOS QR Code Scanner A Simple iOS QR code scanner using Swift UI. Jump to: ContentView.swift screenshot 1.1.5 NOTE: be aware of the new horizontal line

Jun 19, 2022

Fromswifttoswiftui - Swift and SwiftUI materials that cover the following topics - keypath, property wrapper, Combine and result builder

From Swfit to SwiftUI In this repository you can find materials related to the l

Jan 31, 2022

A controller that uses a UIStackView and view controller composition to display content in a list

A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Jun 12, 2022

A simple class that wraps the process of saving or loading a struct or class into a single file

EZFile This is a simple class that wraps the process of saving or loading a stru

May 16, 2022

WIP document editor for iOS

WIP document editor for iOS

¶ Pilcrow This is an work-in-progress experiment on building a document editor similar to Bear, Notion, Notes.app, Craft, Dropbox Paper, and others. I

Jun 4, 2022

AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, best suited for authenticating users over the internet.

AnylineFaceAuthentication AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, be

Mar 7, 2022

A document-based app in Swift Playgrounds 4 for iPad

A document-based app in Swift Playgrounds 4 for iPad

A document-based SwiftUI app in Swift Playgrounds This sample project demonstrat

Jun 16, 2022

Swift framework for document classification using a Core ML model.

Swift framework for document classification using a Core ML model.

DocumentClassifier Overview DocumentClassifier is a Swift framework for classifying documents into one of five categories (Business, Entertainment, Po

May 10, 2022

The sample implementation of zip-archived document for a macOS AppKit platform.

The sample implementation of zip-archived document for a macOS AppKit platform.

The sample implementation of zip-archived document for a macOS AppKit platform. You can implement NSDocument-based I/O of archived document in your application like .sketch or .key.

May 20, 2022

reward the user for watching videos to get coins then use them to get rid of annoying admob ads

reward the user for watching videos to get coins then use them to get rid of annoying admob ads

reward the users for watching youtube videos to the end to earn coins, then use them to get rid of annoying admob ads like banners, interstitial & reward videos

Nov 19, 2021

This to learn such as : Add Target , NSNotification Center Send/Get Data , Observer Override , resize Data By Byte , UIImagePicker Delegate , UIAlert Handle , Top ViewController , Get pickerController

Technicalisto How to Create UIButton Class to Pick Data Image Purpose Learn this topics With exact Task Add Target NSNotification Center Send/Get Data

Feb 20, 2022

RResultBuilder is DSL library based on Result Builder

RResultBuilder is DSL library based on Result Builder

RResultBuilder is DSL library based on Result Builder Features Requirements Installation Usage Screenshot Example Contribute Meta Feat

Mar 22, 2022
Apps for translating Braille document captured by iPhone camera, then send translation result to ITS's Braille printer for duplicating purpose (re-printing, copying braille document with no original text)

SCANDO iOS On my Final Project (Thesis) for my Bachelor degree, I made an apps that translate Braille Document, and send the translation result to the

Aug 10, 2021
TupleResult - A micro library that easily converts tuple result into Swift.Result

TupleResult A micro library that easily converts c-style tuple result into Swift

Jan 29, 2022
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.

MJExtension A fast, convenient and nonintrusive conversion framework between JSON and model. 转换速度快、使用简单方便的字典转模型框架 ?? ✍??Release Notes: more details Co

Jun 15, 2022
This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable coding methodologies!

YouTubeClone This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable co

Jun 17, 2022
A view controller for iOS that allows users to crop portions of UIImage objects
A view controller for iOS that allows users to crop portions of UIImage objects

TOCropViewController TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basi

Jun 28, 2022
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

Mar 7, 2022
Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling
Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling

AnimatedGIFImageSerialization This library is no longer maintained. In iOS 13+ and macOS 10.15+, use CGAnimateImageAtURLWithBlock instead. AnimatedGIF

May 16, 2022
SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It's time to get rid of Objective-C cruft.

SwiftyTimer Modern Swifty API for NSTimer SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It

Jun 5, 2022
A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Jun 14, 2022
Convenient domain specific language for writing programmatic UI built over UIKit and more.

XYKit Swifty and convenient domain specific language for creating programmatic UI in a more declarative way and more than that. Built on top of UIKit

Nov 5, 2021