AttachmentInput is a photo attachment keyboard.It is similar to the keyboard for photo attachment of iOS 11 Messenger.
- Shoot a photo on the keyboard
- Pick image/video on the keyboard
- Pick image/video from UIImagePickerController
- Download and attach image/video stored on iCloud
- Compress image/video
- Get the image/video file name, file size, thumbnail image
- Provides custom features
- Written in Swift 5
- Compatible with iOS 12.0+
- Development with Xcode 12.0+
Add this to your CocoaPods Podfile.
pod 'AttachmentInput'
Add dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/cybozu/AttachmentInput.git", .upToNextMajor(from: "1.0.0"))
]
-
Add privacy properties in
info.plist
with a usage description- Privacy - Photo Library Usage Description
- Privacy - Microphone Usage Description
- Privacy - Camera Usage Description
-
Create AttachmentInput instance
let attachmentInput = AttachmentInput()
-
By returning
AttachmentInput#view
at inputview you can display the keyboard in the class that inheritedUIResponder
override var inputView: UIView? { return attachmentInput.view }
-
Define the behavior when receive the photos in
AttachmentInputDelegate
and set it toAttachmentInput
attachmentInput.delegate = self
-
If you need to use your config, you can pass the config as you create instance
let config = AttachmentInputConfiguration() config.videoQuality = .typeLow attachmentInput = AttachmentInput(configuration: config)
MIT