Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved Swift 5 compiling errors in PhotoLibraryService.swift #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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: 6 additions & 6 deletions src/ios/PhotoLibraryService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ final class PhotoLibraryService {

if(mediaType == "image") {
PHImageManager.default().requestImageData(for: asset, options: self.imageRequestOptions) {
(imageData: Data?, dataUTI: String?, orientation: UIImageOrientation, info: [AnyHashable: Any]?) in
(imageData: Data?, dataUTI: String?, orientation: UIImage.Orientation, info: [AnyHashable: Any]?) in

if(imageData == nil) {
completion(nil)
Expand Down Expand Up @@ -356,7 +356,7 @@ final class PhotoLibraryService {
let asset = obj as! PHAsset

PHImageManager.default().requestImageData(for: asset, options: self.imageRequestOptions) {
(imageData: Data?, dataUTI: String?, orientation: UIImageOrientation, info: [AnyHashable: Any]?) in
(imageData: Data?, dataUTI: String?, orientation: UIImage.Orientation, info: [AnyHashable: Any]?) in

guard let image = imageData != nil ? UIImage(data: imageData!) : nil else {
completion(nil)
Expand Down Expand Up @@ -388,7 +388,7 @@ final class PhotoLibraryService {

if(mediaType == "image") {
PHImageManager.default().requestImageData(for: asset, options: self.imageRequestOptions) {
(imageData: Data?, dataUTI: String?, orientation: UIImageOrientation, info: [AnyHashable: Any]?) in
(imageData: Data?, dataUTI: String?, orientation: UIImage.Orientation, info: [AnyHashable: Any]?) in

if(imageData == nil) {
completion(nil)
Expand Down Expand Up @@ -609,8 +609,8 @@ final class PhotoLibraryService {
}

self.putMediaToAlbum(assetsLibrary, url: assetUrl, album: album, completion: { (error) in


if error != nil {
completion(nil, error)
} else {
Expand Down Expand Up @@ -666,7 +666,7 @@ final class PhotoLibraryService {
fileprivate func getDataFromURL(_ url: String) throws -> Data {
if url.hasPrefix("data:") {

guard let match = self.dataURLPattern.firstMatch(in: url, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, url.characters.count)) else { // TODO: firstMatchInString seems to be slow for unknown reason
guard let match = self.dataURLPattern.firstMatch(in: url, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, url.count)) else { // TODO: firstMatchInString seems to be slow for unknown reason
throw PhotoLibraryError.error(description: "The dataURL could not be parsed")
}
let dataPos = match.range(at: 0).length
Expand Down