BionicReader
public class BionicReader : NSObject
-
Creates a new
BionicReader
instance.This initializer returns
nil
if the API key is not valid.Declaration
Swift
public init?(fixation: Int? = nil, saccade: Int? = nil, opacity: Int? = nil)
Parameters
fixation
if
nil
,fixation
fromBionicReadingSettings
will be used.saccade
if
nil
,saccade
fromBionicReadingSettings
will be used.opacity
if
nil
,opacity
fromBionicReadingSettings
will be used. -
Start a new text block.
This makes sure saccade is correctly applied (if
saccade
is greater than 1) when starting a new text block like for example a paragraph.Declaration
Swift
public func newTextBlock()
-
Reset all parameters.
If you want to reuse an instance of
BionicReader
for another text, you should call this before. This will also updatefixation
,saccade
andopacity
with the current values fromBionicReadingSettings
(if no values for these were provided).Declaration
Swift
public func reset(fixation: Int? = nil, saccade: Int? = nil, opacity: Int? = nil)
Parameters
fixation
if
nil
,fixation
fromBionicReadingSettings
will be used.saccade
if
nil
,saccade
fromBionicReadingSettings
will be used.opacity
if
nil
,opacity
fromBionicReadingSettings
will be used. -
Apply Bionic Reading to a plaintext string.
Bolded parts of the returned HTML will be wrapped using the
<b>
tag.<b class="bionic-b" style="opacity: 1.0;">Bio</b>nic
Important
This method treats
string
as plaintext. If you want to convert a HTML string, you can usebionicReadableHTML(sourceType:fixation:saccade:opacity:)
which will take care of the HTML parsing.Declaration
Swift
public func readableHTML(_ string: String) -> String
Parameters
string
Plaintext string. HTML is not supported for this parameter.
Return Value
HTML string with Bionic Reading applied.