Latest1.1.2
Homepagehttps://github.com/mittsuu/MarkedView-for-iOS
LicenseMIT
Platformsios 8.0, requires ARC
Authors

Version
License
Platform
codebeat badge

img_gif

Introduction

The MarkedView is the markdown text viewer.

select the best one from UIWebview or WKWebview.

  • UIMarkedView

    • UIWebView base
  • WKMarkedView
    • WKWebView base

Usage

It is a simple module, which enable you to convert any files into initialized view.

// Swift
import MarkedView

・・・

// WKWebView base
let mdView = WKMarkedView()
// delegate
mdView.delegate = self

// code block in scrolling be deactivated.
// mdView.setCodeScrollDisable()

// view set
self.view = mdView

// set Markdown text pattern ('contents' object is markdown text)
mdView.textToMark(contents)

// load Markdown file pattern
// mdView.loadFile(filePath)

Delegate

  • UIMarkViewDelegate (UIMarkedView)
extension UIMarkedController: UIMarkViewDelegate {

    func markViewRedirect(url: URL) {
        if #available(iOS 9.0, *) {
            let safari = SFSafariViewController(url: url)
            self.present(safari, animated: true, completion: nil)

        } else {
            if(UIApplication.shared.canOpenURL(url)) {
                UIApplication.shared.openURL(url)
            }
        }
    }
}
  • WKMarkViewDelegate (WKMarkedView)
extension WKMarkedController: WKMarkViewDelegate {

    func markViewRedirect(url: URL) {
        if #available(iOS 9.0, *) {
            let safari = SFSafariViewController(url: url)
            self.present(safari, animated: true, completion: nil)

        } else {
            if(UIApplication.shared.canOpenURL(url)) {
                UIApplication.shared.openURL(url)
            }
        }
    }
}

Installation

MarkedView is available through CocoaPods.

To install it, simply add the following line to your Podfile:

// Swift 3.0
pod 'MarkedView', '~> 1.1.2'

Then run the following command:

$ pod install

See Also

Credits

This used the following open source components.

Marked : Markdown parser written in JavaScript

highlight.js : Syntax highlighting for the Web

Requirements

  • v1.0.0 ~ v1.0.4

    • iOS 8.3+
    • Swift 2.2
    • Xcode 7.3+
  • v1.0.5~

    • iOS 8.0+
    • Swift 2.3
    • Xcode 8.0
  • v1.1.0~
    • iOS 8.0+
    • Swift 3.0
    • Xcode 8.0

License

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

Latest podspec

{
    "name": "MarkedView",
    "version": "1.1.2",
    "summary": "The Markdown text web viewer.",
    "homepage": "https://github.com/mittsuu/MarkedView-for-iOS",
    "license": "MIT",
    "authors": {
        "mittsu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mittsuu/MarkedView-for-iOS.git",
        "tag": "1.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "MarkedView": [
            "Pod/Assets/**/*"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This