Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
a86fc878
Commit
a86fc878
authored
Aug 31, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Text interface
parent
a3638453
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
Source/Text.swift
+7
-4
Source/TextStorage.swift
+2
-2
No files found.
Source/Text.swift
View file @
a86fc878
...
...
@@ -20,8 +20,8 @@ import UIKit
@objc(TextDelegate)
public
protocol
TextDelegate
{
optional
func
textStorageWillProcessEdit
(
text
:
Text
!
,
textStorage
:
TextStorage
!
,
string
:
String
!
,
range
:
NSRange
)
optional
func
textStorageDidProcessEdit
(
text
:
Text
!
,
textStorage
:
TextStorage
!
,
string
:
String
!
,
result
:
NSTextCheckingResult
!
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
optional
func
textStorageWillProcessEdit
(
text
:
Text
,
textStorage
:
TextStorage
,
string
:
String
,
range
:
NSRange
)
optional
func
textStorageDidProcessEdit
(
text
:
Text
,
textStorage
:
TextStorage
,
string
:
String
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
}
public
class
Text
:
NSObject
{
...
...
@@ -49,14 +49,17 @@ public class Text: NSObject {
*/
public
weak
var
delegate
:
TextDelegate
?
/**
:name: init
*/
override
public
init
()
{
textStorage
=
TextStorage
()
super
.
init
()
textStorage
.
searchExpression
=
NSRegularExpression
(
pattern
:
searchPattern
,
options
:
nil
,
error
:
nil
)
textStorage
.
textStorageWillProcessEdit
=
{
(
textStorage
:
TextStorage
!
,
string
:
String
!
,
range
:
NSRange
)
->
Void
in
textStorage
.
textStorageWillProcessEdit
=
{
(
textStorage
:
TextStorage
,
string
:
String
,
range
:
NSRange
)
->
Void
in
self
.
delegate
?
.
textStorageWillProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
string
,
range
:
range
)
}
textStorage
.
textStorageDidProcessEdit
=
{
(
textStorage
:
TextStorage
!
,
result
:
NSTextCheckingResult
!
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
in
textStorage
.
textStorageDidProcessEdit
=
{
(
textStorage
:
TextStorage
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
in
self
.
delegate
?
.
textStorageDidProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
textStorage
.
string
,
result
:
result
,
flags
:
flags
,
stop
:
stop
)
}
}
...
...
Source/TextStorage.swift
View file @
a86fc878
...
...
@@ -18,8 +18,8 @@
import
UIKit
internal
typealias
TextStorageWillProcessEdit
=
(
TextStorage
!
,
String
!
,
NSRange
)
->
Void
internal
typealias
TextStorageDidProcessEdit
=
(
TextStorage
!
,
NSTextCheckingResult
!
,
NSMatchingFlags
,
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
internal
typealias
TextStorageWillProcessEdit
=
(
TextStorage
,
String
,
NSRange
)
->
Void
internal
typealias
TextStorageDidProcessEdit
=
(
TextStorage
,
NSTextCheckingResult
,
NSMatchingFlags
,
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
public
class
TextStorage
:
NSTextStorage
{
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment