forked from ruddfawcett/Notepad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.swift
More file actions
36 lines (28 loc) · 881 Bytes
/
ViewController.swift
File metadata and controls
36 lines (28 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// ViewController.swift
// Notepad
//
// Created by Rudd Fawcett on 10/14/16.
// Copyright © 2016 Rudd Fawcett. All rights reserved.
//
import UIKit
import Notepad
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let editor = Notepad(frame: self.view.bounds, themeFile: "one-dark")
let testFile = Bundle.main.path(forResource: "tests", ofType: "md")
do {
let text = try String(contentsOfFile: testFile!)
editor.text = text
} catch {
print(error)
}
editor.textContainerInset = UIEdgeInsets(top: 40, left: 20, bottom: 40, right: 20)
self.view.addSubview(editor)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}