Skip to content

An NSURL extension for showing preview info of webpages

License

Notifications You must be signed in to change notification settings

Latermedia/URLPreview

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URLPreview

An NSURL extension for showing preview info of webpages.

You may want to use it if you want to mimick Facebook app's behavior when you post a link on your status.

Screenshot

Requirements

This library depends on Kanna - a brilliant library for parsing HTML/XML on Swift.

Usage

Pretty simple, all you need is a block:

if let url = NSURL(string: urlTextField.text!) {
    url.fetchPageInfo({ (title, description, previewImage) -> Void in
      // do whatever you want here
    }, failure: { (errorMessage) -> Void in
      print(errorMessage)
    })
} else {
  print("Invalid URL!")
}

Contributing

Contributions for bug fixing or improvements are welcome. Feel free to submit a pull request.

Licence

URLPreview is available under the MIT license. See the LICENSE file for more info.

About

An NSURL extension for showing preview info of webpages

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 81.4%
  • Shell 13.3%
  • Ruby 4.2%
  • Objective-C 1.1%