Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
AztecEditor-iOS/Example/Example/ViewController.swift at develop · clockify/AztecEditor-iOS · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
clockify
AztecEditor-iOS
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
develop
Breadcrumbs
AztecEditor-iOS
/
Example
/
Example
/
ViewController.swift
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
117 lines (88 loc) · 4.19 KB
develop
Breadcrumbs
AztecEditor-iOS
/
Example
/
Example
/
ViewController.swift
Copy path
Top
File metadata and controls
Code
Blame
117 lines (88 loc) · 4.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import
UIKit
///
///
class
ViewController
:
UITableViewController
{
let
cellIdentifier
=
"
CellIdentifier
"
var
sections
:
[
DemoSection
]
!
// MARK: LifeCycle Methods
override
func
viewDidLoad
(
)
{
super
.
viewDidLoad
(
)
sections
=
[
DemoSection
(
title
:
"
Plain HTML Editor
"
,
rows
:
[
DemoRow
(
title
:
"
Standard Demo
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
content
"
)
}
)
,
DemoRow
(
title
:
"
Captions Demo
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
captions
"
)
}
)
,
DemoRow
(
title
:
"
Image Overlays
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
imagesOverlays
"
)
}
)
,
DemoRow
(
title
:
"
Video Demo
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
video
"
,
wordPressMode
:
false
)
}
)
,
DemoRow
(
title
:
"
Failed Media
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
failedMedia
"
)
}
)
,
DemoRow
(
title
:
"
Big Lists
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
bigLists
"
)
}
)
,
DemoRow
(
title
:
"
Underline NBSP
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
underline
"
)
}
)
,
DemoRow
(
title
:
"
Empty Demo
"
,
action
:
{
self
.
showEditorDemo
(
)
}
)
]
)
,
DemoSection
(
title
:
"
WordPressEditor (Calypso & Gutenberg)
"
,
rows
:
[
DemoRow
(
title
:
"
Gutenberg Demo
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
gutenberg
"
,
wordPressMode
:
true
)
}
)
,
DemoRow
(
title
:
"
Video Shortcode Demo
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
videoShortcodes
"
,
wordPressMode
:
true
)
}
)
,
DemoRow
(
title
:
"
Gutenberg Gallery
"
,
action
:
{
self
.
showEditorDemo
(
filename
:
"
gallery
"
,
wordPressMode
:
true
)
}
)
,
DemoRow
(
title
:
"
Empty Demo
"
,
action
:
{
self
.
showEditorDemo
(
wordPressMode
:
true
)
}
)
]
)
,
]
}
// MARK: Actions
func
showEditorDemo
(
filename
:
String
?
=
nil
,
wordPressMode
:
Bool
=
false
)
{
let
controller
:
EditorDemoController
if
let
filename
=
filename
{
let
sampleHTML
=
getSampleHTML
(
fromHTMLFileNamed
:
filename
)
controller
=
EditorDemoController
(
withSampleHTML
:
sampleHTML
,
wordPressMode
:
wordPressMode
)
}
else
{
controller
=
EditorDemoController
(
wordPressMode
:
wordPressMode
)
}
navigationController
?
.
pushViewController
(
controller
,
animated
:
true
)
}
// MARK: Sample HTML
func
getSampleHTML
(
fromHTMLFileNamed
fileName
:
String
)
->
String
{
let
htmlFilePath
=
Bundle
.
main
.
path
(
forResource
:
fileName
,
ofType
:
"
html
"
)
!
let
fileContents
:
String
do
{
fileContents
=
try
String
(
contentsOfFile
:
htmlFilePath
)
}
catch
{
fatalError
(
"
Could not load the sample HTML. Check the file exists in the target and that it has the correct name.
"
)
}
return
fileContents
}
// MARK: TableView Methods
override
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
sections
.
count
}
override
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
sections
[
section
]
.
rows
.
count
}
override
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
cellIdentifier
)
!
cell
.
accessoryType
=
.
disclosureIndicator
//cell.backgroundColor = UIColor.
let
row
=
sections
[
indexPath
.
section
]
.
rows
[
indexPath
.
row
]
cell
.
textLabel
?
.
text
=
row
.
title
return
cell
}
override
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
40
}
override
func
tableView
(
_
tableView
:
UITableView
,
titleForHeaderInSection
section
:
Int
)
->
String
?
{
return
sections
[
section
]
.
title
}
override
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
tableView
.
deselectRow
(
at
:
indexPath
,
animated
:
true
)
sections
[
indexPath
.
section
]
.
rows
[
indexPath
.
row
]
.
action
(
)
}
}
typealias
RowAction
=
(
)
->
Void
struct
DemoSection
{
var
title
:
String
var
rows
:
[
DemoRow
]
}
struct
DemoRow
{
var
title
:
String
var
action
:
RowAction
}
You can’t perform that action at this time.