An NSURL extension for showing preview info of webpages

Related tags

Parsing URLPreview
Overview

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

  • Swift 5 & Xcode 10.2
  • This library depends on Kanna

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.

You might also like...
Flutter plugin to display VGS card info using TextView or View

VGS Card Info Flutter plugin to display VGS Card info using TextView or View Installation Add the dependency in your pubspec.yaml vgscardinfo: git

A Swift Runtime library for viewing type info, and the dynamic getting and setting of properties.
A Swift Runtime library for viewing type info, and the dynamic getting and setting of properties.

Runtime is a Swift library to give you more runtime abilities, including getting type metadata, setting properties via reflection, and type constructi

Show overlay and info on app components
Show overlay and info on app components

SwiftyOverlay App Intro / Instruction component to show data over app UI at run time! Easy to use, Animated and Customizable. Supported Components are

CountryList - iOS app to show country info
CountryList - iOS app to show country info

CountryList iOS app to show country info Overview 'CountryList App' fetch and di

πŸš„β„ΉοΈ Show current train info (speed, next station, arrival time) in macOS status bar
πŸš„β„ΉοΈ Show current train info (speed, next station, arrival time) in macOS status bar

TrainStatusInfo This macOS application shows the current train status info in the status bar when connected to the trains hotspot. It uses the "intern

A tiny SwiftUI app that displays Albums of Kanye West and a brief info about the artist.

West Day Ever It's a small SwiftUI app, that displays Albums of Kanye West and a brief info about the artist. Technical notes Low level packages that

Weather Dock is a MacOS headless application that shows popover view under the menu bar with weather info.
Weather Dock is a MacOS headless application that shows popover view under the menu bar with weather info.

Weather Dock Weather forecast in MacOS menu bar Weather Dock is a MacOS headless application that shows popover view under the menu bar with weather i

Highly customizable Action Sheet Controller with Assets Preview written in Swift
Highly customizable Action Sheet Controller with Assets Preview written in Swift

PPAssetsActionController Play with me ▢️ πŸ– If you want to play with me, just tap here and enjoy! 🎩 πŸ•΄ Show me πŸŽͺ Try me πŸ“² The easiest way to try me

Preview extractor for news, articles and full-texts in Swift
Preview extractor for news, articles and full-texts in Swift

ReadabilityKit Preview extractor for news, articles and full-texts in Swift We are a development agency building phenomenal apps. Features Extracts: T

It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.

Link Previewer for iOS, macOS, watchOS and tvOS It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.

A Figma component preview for your SwiftUI views
A Figma component preview for your SwiftUI views

FigmaPreviewSwiftUI A Figma component preview for your SwiftUI views. You can use Figma components instead of real views within your app until you imp

Zeplin component preview for your SwiftUI views
Zeplin component preview for your SwiftUI views

A Zeplin component preview for your SwiftUI views. You can use Zeplin components instead of real views within your app until you implement them.

A UIActivityViewController to share images while displaying them as a nice preview.
A UIActivityViewController to share images while displaying them as a nice preview.

PSActivityImageViewController Overview This view controller allows you to share an image the same way as a normal UIActivityViewController would, with

PreviewDevice - library with elegant syntax for Preview Device in SwiftUI
PreviewDevice - library with elegant syntax for Preview Device in SwiftUI

PreviewDevice Requirements Xcode 13.x iOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+ Usage Example: import PreviewDevice struc

XCode Preview template for UIkit based project.
XCode Preview template for UIkit based project.

SwiftPreview XCode Preview template for UIkit based project. Support custom file template class inherit from UIView and UIViewController. How to use?

Window preview app for MacOS (on the dock) using AltTab.

DockAltTab The #1 Window manager/Task switcher & Companion for AltTab v1.1 download link https://github.com/steventheworker/DockAltTab/releases/downlo

PeekView supports peek, pop and preview actions for iOS devices without 3D Touch capibility
PeekView supports peek, pop and preview actions for iOS devices without 3D Touch capibility

PeekView When implementing peek, pop and preview actions with 3D Touch, you may want to support such features for users accessing your app from older

Highly customizable Action Sheet Controller with Assets Preview written in Swift
Highly customizable Action Sheet Controller with Assets Preview written in Swift

PPAssetsActionController Play with me ▢️ πŸ– If you want to play with me, just tap here and enjoy! 🎩 πŸ•΄ Show me πŸŽͺ Try me πŸ“² The easiest way to try me

iOS Framework that makes it easy to preview images on any UIImageView.
iOS Framework that makes it easy to preview images on any UIImageView.

AZImagePreview iOS Framework that makes it easy to preview images on any UIImageView. Screenshots Installation: Cocoa Pods: pod 'AZImagePreview' Swift

Comments
  • Removed Deprecated Code, Added Alamofire and Updated Demo App

    Removed Deprecated Code, Added Alamofire and Updated Demo App

    • Switched it to Alamofire from NSURLConnection

    • Removed Deprecated Code from NSURLConnection

    • Updated demo app

      • Connected TextField's primary action to trigger done
      • Added Dark Mode to the demo app (iOS 13 and up)
      • Set TextField keyboard type to URL
    opened by jiachenyee 3
  • Depreciation

    Depreciation

    'sendAsynchronousRequest(_:queue:completionHandler:)' was deprecated in iOS 9.0: Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h

    Could you please update your code since this is deprecated for a while now? I have tried it my own, but couldn't get it running...

    Errors like that slow down the building process in big Xcode projects.

    opened by davidseek 1
  • Question: Desktop User Agent

    Question: Desktop User Agent

    https://github.com/itsmeichigo/URLPreview/blob/master/Source/NSURL%2BURLPreview.swift#L21 Just curious if there was a specific reason you use a desktop user agent? Do some sites not return the description or image with a standard mobile user agent?

    opened by jstart 1
Owner
Huong Do
Full-time debugger, part-time grammar nazi
Huong Do
Erik is an headless browser based on WebKit. An headless browser allow to run functional tests, to access and manipulate webpages using javascript.

Erik Erik is a headless browser based on WebKit and HTML parser Kanna. An headless browser allow to run functional tests, to access and manipulate web

Eric Marchand 544 Dec 30, 2022
Erik is an headless browser based on WebKit. An headless browser allow to run functional tests, to access and manipulate webpages using javascript.

Erik Erik is a headless browser based on WebKit and HTML parser Kanna. An headless browser allow to run functional tests, to access and manipulate web

Eric Marchand 544 Dec 30, 2022
SwiftyOpenGraph - A swift library that retrieves structured open graph data from webpages.

SwiftyOpenGraph Usage Initialization Base Properties Types Installation License Usage Initialization You use SwiftyOpenGraph by initializing OpenGraph

Quintschaf 1 Jan 6, 2022
QuickLookProtein is a macOS Quick Look extension to preview protein/3D structure files (PDB, SDF, CIF).

QuickLookProtein QuickLookProtein is a macOS Quick Look extension to preview protein/3D structure files (PDB, SDF, CIF). It works in all places where

Jethro Hemmann 32 Sep 13, 2022
A UIImageView extension to let the picture-cutting with faces showing better

UIImageView-BetterFace A UIImageView extension to let the picture-cutting with faces showing better Last update in v0.2_stable : add a UIImage+BetterF

Croath Liu 779 Sep 1, 2022
Swift library to easily check the current device and some more info about it.

Usage To run the example project, clone the repo, and run pod install from the Example directory first. let device = Deviice.current device is a Devi

Andrea Mario Lufino 56 Nov 3, 2022
In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

The debugger tool for iOS developer. Display logs, network request, device informations, crash logs while using the app. Easy accessible with its bubble head button ?? . Easy to integrate in any apps, to handle development or testing apps easier. First version, there is plenty of room for improvement.

Remi ROBERT 1.8k Dec 29, 2022
Dice roller, character sheet/ creator, and monster/item info app on the iphone12

DnD-LordDogMaw This file will be the start of a side project in the hopes of creating an iphone12 app for Dungeons and Dragons! This app will have 3 m

Paige Guajardo 2 Sep 17, 2021
Dotzu In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

Dotzu In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More. The debugger tool for iOS developer. Display logs, n

Remi ROBERT 1.8k Jan 3, 2023
Swift library to easily check the current device and some more info about it.

Usage To run the example project, clone the repo, and run pod install from the Example directory first. let device = Deviice.current device is a Devi

Andrea Mario Lufino 56 Nov 3, 2022