Skip to content

Commit

Permalink
Remove Parse from SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
zvonicek committed Jan 19, 2020
1 parent d1b2699 commit dc7bce3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
17 changes: 6 additions & 11 deletions ImageSlideshow/Classes/InputSources/ParseSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
//
// Created by Jaime Agudo Lopez on 14/01/2017.
//

import UIKit
#if SWIFT_PACKAGE
import ImageSlideshow
#endif
import ParseSwift
import Parse

/// Input Source to image using Parse
public class ParseSource: NSObject, InputSource {
var file: File
var file: PFFileObject
var placeholder: UIImage?

/// Initializes a new source with URL and optionally a placeholder
/// - parameter url: a url to be loaded
/// - parameter placeholder: a placeholder used before image is loaded
public init(file: File, placeholder: UIImage? = nil) {
public init(file: PFFileObject, placeholder: UIImage? = nil) {
self.file = file
self.placeholder = placeholder
super.init()
Expand All @@ -28,13 +23,13 @@ public class ParseSource: NSObject, InputSource {
@objc public func load(to imageView: UIImageView, with callback: @escaping (UIImage?) -> Void) {
imageView.image = self.placeholder

self.file.fetch { (file, error) in
if let data = file?.data, let image = UIImage(data: data) {
self.file.getDataInBackground {(data: Data?, error: Error?) in
if let data = data, let image = UIImage(data: data) {
imageView.image = image
callback(image)
} else {
callback(nil)
}
}
}
}
}
15 changes: 3 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ let package = Package(
targets: ["ImageSlideshowSDWebImage"]),
.library(
name: "ImageSlideshow/Kingfisher",
targets: ["ImageSlideshowKingfisher"]),
.library(
name: "ImageSlideshow/Parse",
targets: ["ImageSlideshowParse"])
targets: ["ImageSlideshowKingfisher"])
],
dependencies: [
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "5.8.0"),
.package(url: "https://github.com/Alamofire/AlamofireImage.git", .branch("master")),
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0"),
.package(url: "https://github.com/parse-community/Parse-Swift.git", .branch("master")),
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0")
],
targets: [
.target(
Expand Down Expand Up @@ -63,12 +59,7 @@ let package = Package(
name: "ImageSlideshowKingfisher",
dependencies: ["ImageSlideshow", "Kingfisher"],
path: "ImageSlideshow/Classes/InputSources",
sources: ["KingfisherSource.swift"]),
.target(
name: "ImageSlideshowParse",
dependencies: ["ImageSlideshow", "ParseSwift"],
path: "ImageSlideshow/Classes/InputSources",
sources: ["ParseSource.swift"])
sources: ["KingfisherSource.swift"])
],
swiftLanguageVersions: [.v4, .v4_2, .v5]
)

0 comments on commit dc7bce3

Please sign in to comment.