forked from nathantannar4/InputBarAccessoryView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·366 lines (320 loc) · 19.6 KB
/
index.html
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<!DOCTYPE html>
<html lang="en">
<head>
<title> Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
<script src="js/lunr.min.js" defer></script>
<script src="js/typeahead.jquery.js" defer></script>
<script src="js/jazzy.search.js" defer></script>
</head>
<body>
<a title=" Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
<div class="header-right">
<form role="search" action="search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</div>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/AttachmentCell.html">AttachmentCell</a>
</li>
<li class="nav-group-task">
<a href="Classes/AttachmentCollectionView.html">AttachmentCollectionView</a>
</li>
<li class="nav-group-task">
<a href="Classes/AttachmentManager.html">AttachmentManager</a>
</li>
<li class="nav-group-task">
<a href="Classes/AttachmentManager/Attachment.html">– Attachment</a>
</li>
<li class="nav-group-task">
<a href="Classes/AutocompleteCell.html">AutocompleteCell</a>
</li>
<li class="nav-group-task">
<a href="Classes/AutocompleteManager.html">AutocompleteManager</a>
</li>
<li class="nav-group-task">
<a href="Classes/AutocompleteSession.html">AutocompleteSession</a>
</li>
<li class="nav-group-task">
<a href="Classes/AutocompleteTableView.html">AutocompleteTableView</a>
</li>
<li class="nav-group-task">
<a href="Classes/ImageAttachmentCell.html">ImageAttachmentCell</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputBarButtonItem.html">InputBarButtonItem</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputBarButtonItem/Spacing.html">– Spacing</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputBarSendButton.html">InputBarSendButton</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputBarViewController.html">InputBarViewController</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputStackView.html">InputStackView</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputStackView/Position.html">– Position</a>
</li>
<li class="nav-group-task">
<a href="Classes/InputTextView.html">InputTextView</a>
</li>
<li class="nav-group-task">
<a href="Classes/KeyboardManager.html">KeyboardManager</a>
</li>
<li class="nav-group-task">
<a href="Classes/SeparatorLine.html">SeparatorLine</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/KeyboardEvent.html">KeyboardEvent</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/NSAttributedString.html">NSAttributedString</a>
</li>
<li class="nav-group-task">
<a href="Extensions/NSAttributedString/Key.html">– Key</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UITextView.html">UITextView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/AttachmentManagerDataSource.html">AttachmentManagerDataSource</a>
</li>
<li class="nav-group-task">
<a href="Protocols/AttachmentManagerDelegate.html">AttachmentManagerDelegate</a>
</li>
<li class="nav-group-task">
<a href="Protocols/AutocompleteManagerDataSource.html">AutocompleteManagerDataSource</a>
</li>
<li class="nav-group-task">
<a href="Protocols/AutocompleteManagerDelegate.html">AutocompleteManagerDelegate</a>
</li>
<li class="nav-group-task">
<a href="Protocols/InputBarAccessoryViewDelegate.html">InputBarAccessoryViewDelegate</a>
</li>
<li class="nav-group-task">
<a href="Protocols/InputItem.html">InputItem</a>
</li>
<li class="nav-group-task">
<a href="Protocols/InputPlugin.html">InputPlugin</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/AutocompleteCompletion.html">AutocompleteCompletion</a>
</li>
<li class="nav-group-task">
<a href="Structs/HorizontalEdgePadding.html">HorizontalEdgePadding</a>
</li>
<li class="nav-group-task">
<a href="Structs/KeyboardNotification.html">KeyboardNotification</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:21InputBarAccessoryView011AttachmentsD0a">AttachmentsView</a>
</li>
<li class="nav-group-task">
<a href="Typealiases.html#/s:21InputBarAccessoryView0A7Managera">InputManager</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<p><a href=""><img src="./Screenshots/Preview.gif" alt="Image"></a></p>
<h1 id='inputbaraccessoryview' class='heading'>InputBarAccessoryView</h1>
<h3 id='features' class='heading'>Features</h3>
<ul>
<li>[x] Autocomplete text with @mention, #hashtag or any other prefix</li>
<li>[x] A self-sizing <code>UITextView</code> with an optional fixed height (can be replaced with any other view)</li>
<li>[x] Image paste support<br></li>
<li>[x] Autocomplete attributed text highlighting</li>
<li>[x] Reactive components that respond to given events</li>
<li>[x] Top/Bottom/Left/Right <code><a href="Classes/InputStackView.html">InputStackView</a></code>s that act as toolbars to place buttons</li>
<li>[x] <code>RxSwift</code>/<code>RxCocoa</code> Support with <code>RxExtensions</code> Cocoapod subspec</li>
<li>[x] Drop in attachment view for file/photo management</li>
<li>[x] Plugin support for your own <code><a href="Protocols/InputPlugin.html">InputPlugin</a></code>s</li>
<li>[x] Compatible with all iPhones and iPads</li>
<li>[x] RTL Support</li>
</ul>
<h3 id='installation-via-swift-package-manager-spm' class='heading'>Installation via Swift Package Manager (SPM)</h3>
<p>The <a href="https://swift.org/package-manager/">Swift Package Manager</a> is a tool for automating the distribution of Swift code and is integrated into the <code>swift</code> compiler.
Once you have your Swift package set up, adding InputBarAccessoryView as a dependency is as easy as adding it to the dependencies value of your Package.swift.</p>
<pre class="highlight plaintext"><code>dependencies: [
.package(url: "https://github.com/nathantannar4/InputBarAccessoryView.git", .upToNextMajor(from: "5.2.0"))
]
</code></pre>
<p>You can also add it via Xcode SPM editor with URL:</p>
<pre class="highlight plaintext"><code>https://github.com/nathantannar4/InputBarAccessoryView.git
</code></pre>
<p>To make <code>RxSwift</code>/<code>RxCocoa</code> extensions work you need to explicitly import <code>Rx</code> dependencies.</p>
<h3 id='installation-via-cocoapods' class='heading'>Installation via CocoaPods</h3>
<pre class="highlight ruby"><code><span class="c1"># Swift 5.5</span>
<span class="n">pod</span> <span class="s1">'InputBarAccessoryView'</span>
<span class="c1"># Swift 5.0</span>
<span class="n">pod</span> <span class="s1">'InputBarAccessoryView'</span><span class="p">,</span> <span class="s1">'5.1.0'</span>
</code></pre>
<h3 id='installation-via-carthage' class='heading'>Installation via Carthage</h3>
<pre class="highlight ruby"><code><span class="c1"># Swift 5.5</span>
<span class="n">github</span> <span class="s2">"nathantannar4/InputBarAccessoryView"</span>
<span class="c1"># Swift 5.0</span>
<span class="n">github</span> <span class="s2">"nathantannar4/InputBarAccessoryView"</span> <span class="s2">"5.1.0"</span>
</code></pre>
<h3 id='requirements' class='heading'>Requirements</h3>
<p>iOS 12.0+
Swift 5.5</p>
<blockquote>
<p>The latest iOS 11 release is v5.1.0</p>
<p>The latest iOS 9 + iOS 10 release is v4.3.3</p>
<p>The latest Swift 5.0 release is v5.1.0 </p>
<p>The latest Swift 4.2 release is v4.2.2 </p>
</blockquote>
<h3 id='documentation' class='heading'>Documentation</h3>
<p><a href="./GETTING_STARTED.md">Getting Started</a></p>
<blockquote>
<p>See the Example project to see how you can make the iMessage, Slack, Facebook and GitHawk input bars!</p>
</blockquote>
<h3 id='example-usage' class='heading'>Example Usage</h3>
<p><img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotA.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotB.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotC.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotD.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotE.png" width="242" height="432"> <img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/ScreenshotF.png" width="242" height="432"></p>
<h3 id='featured-in' class='heading'>Featured In</h3>
<p>Add your app to the list of apps using this library and make a pull request.</p>
<ul>
<li><p><a href="https://github.com/MessageKit/MessageKit">MessageKit</a> <em>(renamed to MessageInputBar)</em></p>
<p>
<img src="https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/mklogo.png" title="MessageKit Logo" height="50">
</p></li>
<li><p><a href="https://github.com/GitHawkApp/MessageViewController">MessageViewController</a> <em>(Autocomplete Highlighting Algorithm)</em></p>
<p>
<img src="https://avatars3.githubusercontent.com/u/32285710?s=200&v=4" title="GitHawk Logo" height="50">
</p></li>
</ul>
<h3 id='see-also' class='heading'>See Also</h3>
<p>iMessage style <a href="https://github.com/nathantannar4/TypingIndicator">TypingIndicator</a> for chat apps</p>
<h2 id='latest-releases' class='heading'>Latest Releases</h2>
<p>5.5.0</p>
<ul>
<li>Update SPM tools to Swift 5.5</li>
<li>Added new optional delegate method for custom attachments size</li>
<li>Added new animations for left/right stack view constraints</li>
</ul>
<p>5.4.0</p>
<ul>
<li>Make sure framework is ready for Xcode 13</li>
<li>Fix availability in AppExtensions</li>
<li>Fix Package.swift to support iOS 12+ only</li>
</ul>
<p>5.3.0</p>
<ul>
<li>Allow setting <code>canBecomeFirstResponder</code></li>
<li>Fix interactive keyboard dismissal lag</li>
<li>Add example implemntation of <code>sendButton</code> animation</li>
</ul>
<p>5.2.3</p>
<ul>
<li>Fixed appendSpaceOnCompletion inserting space at wrong location</li>
</ul>
<p>5.2.2</p>
<ul>
<li>Added an optional offset in KeyboardManager.bind(tableView:)</li>
<li>Change reuseIdentifier from <code>public</code> to <code>open</code> to allow inheritance</li>
<li>Fix send button loading indicator for dark mode</li>
<li>Fix iOS 14 UIPasteboard system notification with images</li>
</ul>
<p>5.2.0</p>
<ul>
<li>Drop support for iOS 11 and bump minimum version to iOS 12+</li>
<li>Support Swift 5.3 and higher for Xcode 12</li>
</ul>
<p>See <a href="./CHANGELOG.md">CHANGELOG</a> for more details and older releases.</p>
<p><strong>Find a bug? Open an issue!</strong></p>
<h2 id='layout' class='heading'>Layout</h2>
<p>The layout of the <code><a href="Classes/InputBarAccessoryView.html">InputBarAccessoryView</a></code> is made of of 4 <code><a href="Classes/InputStackView.html">InputStackView</a></code>‘s and an <code><a href="Classes/InputTextView.html">InputTextView</a></code>. The padding of the subviews can be easily adjusted by changing the <code>padding</code> and <code>textViewPadding</code> properties. The constraints will automatically be updated.</p>
<p><img src="https://raw.githubusercontent.com/nathantannar4/InputBarAccessoryView/master/Screenshots/Layout.png"></p>
<p>It is important to note that each of the <code><a href="Classes/InputStackView.html">InputStackView</a></code>’s to the left and right of the <code><a href="Classes/InputTextView.html">InputTextView</a></code> are anchored by a width constraint. This way the <code><a href="Classes/InputTextView.html">InputTextView</a></code> will always fill the space inbetween in addition to providing methods that can easily be called to hide all buttons to the right or left of the <code><a href="Classes/InputTextView.html">InputTextView</a></code> by setting the width constraint constant to 0. The bottom and top stack views are not height constraint and rely on their <code>intrinsicContentSize</code></p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">setLeftStackViewWidthConstant</span><span class="p">(</span><span class="n">to</span> <span class="nv">newValue</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animated</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span>
<span class="kd">func</span> <span class="nf">setRightStackViewWidthConstant</span><span class="p">(</span><span class="n">to</span> <span class="nv">newValue</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animated</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span>
</code></pre>
<h3 id='reactive-hooks' class='heading'>Reactive Hooks</h3>
<p>Each <code><a href="Classes/InputBarButtonItem.html">InputBarButtonItem</a></code> has properties that can hold actions that will be executed during various hooks such as the button being touched, the <code>UITextView</code>text changing and more! Thanks to these easy hooks with a few lines of code the items can be easily resized and animated similar to that of the Facebook messenger app.</p>
<pre class="highlight swift"><code><span class="c1">// MARK: - Hooks</span>
<span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">InputBarButtonItemAction</span> <span class="o">=</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onTouchUpInsideAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardEditingBeginsAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardEditingEndsAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onKeyboardSwipeGestureAction</span><span class="p">:</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">,</span> <span class="kt">UISwipeGestureRecognizer</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onTextViewDidChangeAction</span><span class="p">:</span> <span class="p">((</span><span class="kt">InputBarButtonItem</span><span class="p">,</span> <span class="kt">InputTextView</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onSelectedAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onDeselectedAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onEnabledAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
<span class="kd">private</span> <span class="k">var</span> <span class="nv">onDisabledAction</span><span class="p">:</span> <span class="kt">InputBarButtonItemAction</span><span class="p">?</span>
</code></pre>
<h2 id='author' class='heading'>Author</h2>
<p>
<img src="https://github.com/nathantannar4/NTComponents/raw/master/NTComponents/Assets/Nathan.png" width="100" height="100">
</p>
<p><strong>Nathan Tannar</strong> - <a href="https://nathantannar.me">https://nathantannar.me</a>
<strong>Jakub Kaspar</strong> - <a href="https://jakubkaspar.dev">https://jakubkaspar.dev</a></p>
<h2 id='license' class='heading'>License</h2>
<p>Distributed under the MIT license. See <code>LICENSE</code> for more information.</p>
</section>
</section>
<section id="footer">
<p>© 2022 <a class="link" href="" target="_blank" rel="external noopener"></a>. All rights reserved. (Last updated: 2022-05-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</html>