Giter Site home page Giter Site logo

cmtrounce / swurl Goto Github PK

View Code? Open in Web Editor NEW
201.0 201.0 17.0 223 KB

Lightweight and customisable async image loading in SwiftUI. Supports on-disk storage, placeholders and more!

License: MIT License

Swift 100.00%
asyncimage image-loading-from-server image-loading-library imageview placeholder-image swiftui

swurl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swurl's Issues

Result url not present in handleDownload

Here is the view:

var body: some View { VStack(alignment: .center, spacing: 16, content: { Spacer() HStack { Spacer() RemoteImageView(url: contact.iconUrl(), placeholderImage: Image.init("ministry_logo"), transition: .custom(transition: .opacity, animation: .easeOut(duration: 0.5))).frame(width: 100, height: 100, alignment: .center) Spacer() } }) }

When enabling logging, this is the message I get: "Result url not present in handleDownload" which obviously is not obvious at all. What I am missing here?

Aspect Ratio?

How to control aspect ratio of final image?
Do I need "monkey-patch" TransitioningImage?

Problem of : Argument labels '(_:)' do not match any available overloads

Hello ! I just installed the library and created an image but i received this error :
Argument labels '(_:)' do not match any available overloads
This is my code :

import SwiftUI
import SwURL

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Hello World")
            RemoteImageView(url: URL("https://placeholder.com/150")) // the error appears here
        }
    }
}

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

Crash in RemoteImage.swift

I've got around 100 crashed last week on:
Fatal error: Attempted to read an unowned reference but object 0x281a63d90 was already deallocated2019-09-09 12:53:13.434243+0300[14534:1447031] Fatal error: Attempted to read an unowned reference but object
on 34 String in RemoteImage.string
crash

Prefetch images?

It’s often the case that in the case of a long list we want to start pre-fetching images so users don’t have to see the placeholder view. It would be great to have an imperative way to do that and cache them to the configured cache.

RemoteImageView Bug in 0.4.1

When attempting to use RemoteImageView with 0.4.1 I got the following error, “Static method 'buildBlock' requires that 'SwURL' conform to 'View'”. When I changed to 0.4.0 the error message went away.

Persistent storage restricted to URL lastPathComponent only

Hi,

Thanks for the project. this is not a bug but since i have the same name of images from the network from difference server locations, persistent storage seems to show the same image over. If there can be a way to specify the directory also, it would be helpful.

Like in the file Cache ->PersistentImageCache.swift

   private extension PersistentImageCache {  
       func storageURL(for imageURL: URL) throws -> URL {
           return FileManager
               .cachesDir()
               .appendingPathComponent(imageURL.lastPathComponent)
       }
   }

to include the directory component also from the URL.

Loading 100+ images causes exc_bad_access sometimes

I'm showing 100 + images in a List and sometimes getting this error. What could be the problem? Can you help me please?
Tested on simulator iPhone 12 (iOS 14.5) and device iPhone 12 Mini (iOS 14.6).

Screen Shot 2021-07-29 at 11 35 30

image

Code is similar to this format

List{
                ForEach((0..<500), id: \.self) {
                  index in
                  HStack{
                    RemoteImageView(url: URL(string:"https://picsum.photos/200/300")!)
                    RemoteImageView(url: URL(string:"https://picsum.photos/200/300")!)

                  }

                }
              }

Image not displaying correctly inside a Navigation item

If you use the image inside a navigation item it displays as a blue rectangle. The following modifier is required on the image to prevent this issue .renderingMode(.original),

An example is shown below

TransitioningImage.init(placeholder: placeholderImage?.resizable().renderingMode(.original),
finalImage: remoteImage.load(url: url).image?.resizable().renderingMode(.original),
transitionType: transitionType)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.