Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
adds custom url example
Browse files Browse the repository at this point in the history
  • Loading branch information
icanzilb committed Aug 7, 2017
1 parent 183df5b commit e7e424f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,20 @@ An element of type `img` fetches an image from the web and caches it locally. Th

If you set the value of the `url` column to a valid url address, the text or image will become tappable elements and open the target url either in a safari view controller or directly in Safari (check the docs for details).

If a link starts with the `app://` scheme it will, upon a tap, call your custom URL handling closure so you have the chance to react to link taps in your app's code. Here's a quick example:

```swift
// example link: "app://cart/product/id/123"

let vc = ContentViewController(page: myContentPageObject)
vc.openCustomURL = { url in
if url.host == "cart" {
myCart.addProductWithId(url.lastPathComponent)
}
}
present(vc, animated: true)
```

### Markdown

The library includes class for rendering Markdown content. If you're using CocoaPods make sure to include the sub-spec called `RealmContent.Markdown`.
Expand Down

0 comments on commit e7e424f

Please sign in to comment.