Talk about how to contribute to open source software from Sdwebimage

Source: Internet
Author: User

Source: Bole Online-cool Hall of Sorrow

Links: http://ios.jobbole.com/89483/

Click → apply to join Bole Online column author

Talk about how to contribute to open source software from Sdwebimage

Acquaintance-Know me that my heart is worried, I do not know what I beg

Today, when chatting with others, I pulled this very famous open source library. Sdwebimage and I have known each other for 3 years and 11 months. Nearly four years of time, said short not short, said long not long.

As an IOS developer, the first library I contacted was Sdwebimage (the second is asihttprequest), and the longest study was sdwebimage.

Just after I learned the basics and started to do the project, I used the image cache library. The following code is the first knowledge I learned from Sdwebimage, and the most important one: how to design a method that accepts multiple optional parameters and allows callers to use them simply.

For the fledgling me, this code brings me in addition to the above knowledge, I also learned how to write extensions to existing classes, the first time to see block the power of ...

@Implementation Uiimageview (webcache)

- (void)setimagewithurl:(nsurl *)URL

{

[self setimagewithurl:url placeholderimage:nil];

}

- (void)setimagewithurl:(nsurl *)URL placeholderimage: (UIImage *)placeholder

{

[self setimagewithurl:url placeholderimage:placeholder options: 0];

}

- (void)setimagewithurl:(nsurl *)URL placeholderimage: (UIImage *)placeholder options:('sdwebimage'options) Options

{

'sdwebimage'Manager *Manager = ['sdwebimage'manager Sharedmanager ];

//Remove in Progress Downloader from queue

[manager cancelfordelegate:self];

self. Image = placeholder;

if (url)

{

[manager downloadwithurl:url delegate:self options:options];

}

}

#if ns_blocks_available

- (void)setimagewithurl:(nsurl *)URL success:(' Sdwebimage'successblock)success failure:('sdwebimage' Failureblock)failure;

{

[self setimagewithurl:url placeholderimage:nil success:success failure:failure];

}

- (void)setimagewithurl:(nsurl *)URL placeholderimage: (UIImage *)placeholder success:('sdwebimage'successblock) Success Failure:('sdwebimage'failureblock)failure;

{

[self setimagewithurl:url placeholderimage:placeholder options: 0 Success:success failure:failure];

}

- (void)setimagewithurl:(nsurl *)URL placeholderimage:( UIImage *)placeholder options:('sdwebimage'options)options Success:('sdwebimage'successblock)success failure:(' sdwebimage'failureblock)failure;

{

'sdwebimage'Manager *Manager = ['sdwebimage'manager Sharedmanager ];

//Remove in Progress Downloader from queue

[manager cancelfordelegate:self];

self. Image = placeholder;

if (url)

{

[manager downloadwithurl:url delegate:self options:options Success:success failure:failure];

}

}

#endif

In fact, through this project, you can also learn more, for example, how to determine the type of picture through NSData, how to manage multi-threaded queue ...

The joy of a new acquaintance--sadness, sorrow, parting

I don't know when I signed up for the GitHub account and watched the open source project.

After a watch operation on a particular item, any new conversation (merge submission, creation of a new issue, and someone replying to issue) will produce an unread notification.

As I became more aware of it, I discovered a series of shocking facts:

    • This library is only updated by two developer maintainers

    • The oldest non-closed issue from 2011

    • Almost all versions have a bug of varying size (crash, getting the wrong picture, callback not executing ...). These facts struck me again and again, and as an open-source library with 15,824 Star, it was so fragile. So I became a volunteer and I worked hard to help the developer team solve the issue.

Kill – Eliminate bugs and be the dream of all programmers

Bugs are a nightmare for all programmers, and there are a lot of bugs that happen in certain situations and cannot be avoided by the development team alone. As a result of this project, can we make some contribution?

Most developers may find themselves unable to contribute to the code. So, can we act as testers for the project?

I will briefly list what some ordinary developers can do (mainly Sdwebimage + CocoaPods for example). I hope you will be able to contribute to open source software together.

SDWebImageThe current version number is3.8.2

    • The short-Term Development branch of the project uses pod ' Sdwebimage ', ' ~> 3.8.2 ', and periodically performs pod update.

      You can quickly receive a bug fix release that can help verify that a bug has been resolved.

    • The long-term Development branch of the project uses pod ' Sdwebimage ', ' ~> 3.8 ', and periodically performs pod update.

      Can quickly receive a small feature update version, you may need to modify the project code, there is a small probability of a bug.

    • Use pod ' sdwebimage ', ' ~> 3 ' in new projects, and perform pod update on a regular basis. When there is a major version of the update, there is a great probability that you need to modify the project code, there is a large probability of a bug.

    • Revise Podfile periodically based on version update

    • When you find a bug, create a issue in time. Click here to create

      Https://github.com/rs/%60SDWebImage%60/issues/new

Postscript

The Sdwebimage 4.0 version is already on the road, and this version provides finer-grained control of load requests, compatible with Swift 3, using the latest OC syntax ...

Talk about how to contribute to open source software from Sdwebimage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.