- 0.0.2 and main126.96.36.199.04.2
- 0.0.2 and mainiOSmacOS(Intel)macOS(ARM)LinuxtvOSwatchOS
Nice Photon is available for hire! Talk to us if you have any iOS app development needs. We have 10+ years of experience making iOS apps for top Silicon Valley companies. Reach out at firstname.lastname@example.org
TelegraphKit allows you to show web-content from telegra.ph in a way that looks & feels native on an iOS device.
"Wait, what on Earth is telegra.ph?"
Telegraph is "a publishing tool that lets you create richly formatted posts with photos and all sorts of embedded stuff". It's main advantage is that you can create posts in seconds, with no need for an account and no configuration. And then using TelegraphKit you can easily show these posts in your app.
Create a post on telegra.ph. There is no need to create an account or configure anything. Tap "PUBLISH" and copy the link.
Add TelegraphKit to your project (see "Installation" section below)
Somewhere in your project:
import TelegraphKit let url = URL(string: "<your-telegraph-url>")! let telegraphVC = TelegraphViewController(url: url) let nvc = UINavigationController(rootViewController: telegraphVC) self.present(nvc, animated: true)
TelegraphKit is built on top of WKWebView that adds a few extra features specifically for telegra.ph articles:
|Default telegra.ph look||TelegraphKit version|
let telegraphVC = TelegraphViewController(url: URL(string: "https://telegra.ph/This-is-TelegraphKit-02-03")!) // or let telegraphVC = TelegraphViewController(postID: "This-is-TelegraphKit-02-03")
You can configure the appearance of your
TelegraphViewController by using
let telegraphVC = TelegraphViewController(postID: "<your-post-id>", appearance: .appleSystem)
TelegraphKit provides you with two presets:
TelegraphViewController.Appearance --->.appleSystem // (default) --->.telegraph --->.defaultAppearance // (equals .appleSystem by default)
You can fine-tune the appearance by creating it directly:
TelegraphViewController.Appearance( fontStyle: TelegraphViewController.Appearance.FontStyle, // .appleSystem or .telegraph hideAuthor: Bool, darkModeSupport: Bool, // true by default disableImageInteraction: Bool, // true by default disableSelection: Bool // false by default )
To change the default appearance globally, you can modify
// Somewhere in AppDelegate.swift or similar: TelegraphViewController.Appearance.defaultAppearance = .telegraph