Skip to content

Support for URL instead of NSURL #18

Closed
@aheze

Description

@aheze

New Feature Request Checklist

  • I have checked the current documentations or APIs and did not find a solution
  • I have searched for a similar issue in the project and found none

Feature Request Description

Currently, you make a NSURL from PHAsset like this:

// Create with `PHAsset`
let asset: PHAsset
let photosURL = NSURL.sd_URL(with: asset)

// Load image (assume using custom manager)
imageView.sd_setImage(with: photosURL, placeholderImage: nil, context: [.customManager: manager])

However, sd_setImage(with: takes a URL, not NSURL.

Screen Shot 2020-12-30 at 8 20 47 PM

I would like to be able to get a URL from PHAsset, something like this:

// Create with `PHAsset`
let asset: PHAsset
let photosURL = URL.sd_URL(with: asset) /// URL not NSURL

// Load image (assume using custom manager)
imageView.sd_setImage(with: photosURL, placeholderImage: nil, context: [.customManager: manager])

This would avoid the error, and I think URLs are safer than NSURLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions