diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..919434a6
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/MathFontBundle/MathFontBundle-Info.plist b/MathFontBundle/MathFontBundle-Info.plist
deleted file mode 100644
index 946eb39c..00000000
--- a/MathFontBundle/MathFontBundle-Info.plist
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleIconFile
-
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- ${PRODUCT_NAME}
- CFBundlePackageType
- BNDL
- CFBundleShortVersionString
- 1.0
- CFBundleSignature
- ????
- CFBundleVersion
- 1
- CFPlugInDynamicRegisterFunction
-
- CFPlugInDynamicRegistration
- NO
- CFPlugInFactories
-
- 00000000-0000-0000-0000-000000000000
- MyFactoryFunction
-
- CFPlugInTypes
-
- 00000000-0000-0000-0000-000000000000
-
- 00000000-0000-0000-0000-000000000000
-
-
- CFPlugInUnloadFunction
-
- NSHumanReadableCopyright
- Copyright © 2014 MathChat.
-
-
diff --git a/MathFontBundle/en.lproj/InfoPlist.strings b/MathFontBundle/en.lproj/InfoPlist.strings
deleted file mode 100644
index 477b28ff..00000000
--- a/MathFontBundle/en.lproj/InfoPlist.strings
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Localized versions of Info.plist keys */
-
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 00000000..a80917a3
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,38 @@
+// swift-tools-version: 5.6
+
+import PackageDescription
+
+let package = Package(
+ name: "iosMath",
+ defaultLocalization: "en",
+ platforms: [.iOS(.v10), .macOS(.v11)],
+ products: [
+ .library(
+ name: "iosMath",
+ targets: ["iosMath"])
+ ],
+ dependencies: [],
+ targets: [
+ .target(
+ name: "iosMath",
+ dependencies: [],
+ path: "./iosMath",
+ resources: [
+ .process("fonts")
+ ],
+ cSettings: [
+ .headerSearchPath("./render"),
+ .headerSearchPath("./lib"),
+ .headerSearchPath("./render/internal"),
+ ]
+ ),
+ .testTarget(
+ name: "iosMathTests",
+ dependencies: ["iosMath"],
+ path: "iosMathTests",
+ cSettings: [
+ .headerSearchPath("../iosMath/render"),
+ ]
+ ),
+ ]
+)
diff --git a/iosMath/LICENSE b/iosMath/LICENSE
deleted file mode 100644
index 80752fda..00000000
--- a/iosMath/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 MathChat
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/iosMath/README.md b/iosMath/README.md
deleted file mode 100755
index fc22cf04..00000000
--- a/iosMath/README.md
+++ /dev/null
@@ -1,238 +0,0 @@
-# iosMath
-
-[](https://travis-ci.org/kostub/iosMath)
-[](http://cocoapods.org/pods/iosMath)
-[](http://cocoapods.org/pods/iosMath)
-[](http://cocoapods.org/pods/iosMath)
-
-`iosMath` is a library for displaying beautifully rendered math equations
-in iOS and MacOS applications. It typesets formulae written using the LaTeX in
-a `UILabel` equivalent class. It uses the same typesetting rules as LaTeX and
-so the equations are rendered exactly as LaTeX would render them.
-
-It is similar to [MathJax](https://www.mathjax.org) or
-[KaTeX](https://github.com/Khan/KaTeX) for the web but for native iOS or MacOS
-applications without having to use a `UIWebView` and Javascript. More
-importantly, it is significantly faster than using a `UIWebView`.
-
-## Examples
-Here are screenshots of some formulae that you could render with this
-library:
-
-
-
-
-
-
-
-
-
-The [EXAMPLES.md](./EXAMPLES.md) file contains more examples.
-
-## Requirements
-`iosMath` works on iOS 6+ or MacOS 10.8+ and requires ARC to build. It depends
-on the following Apple frameworks:
-
-* Foundation.framework
-* CoreGraphics.framework
-* QuartzCore.framework
-* CoreText.framework
-
-Additionally for iOS it requires:
-* UIKit.framework
-
-Additionally for MacOS it requires:
-* AppKit.framework
-
-## Installation
-
-### Cocoapods
-
-iosMath is available through [CocoaPods](http://cocoapods.org). To install
-it:
-
-1. Add a entry for iosMath to your Podfile: `pod 'iosMath'`.
-2. Install the pod by running `pod install`.
-
-### Static library
-
-You can also add iosMath as a static library to your project or
-workspace.
-
-1. Download the [latest code version](https://github.com/kostub/iosMath/downloads) or add the
-repository as a git submodule to your git-tracked project.
-2. Open your project in Xcode, then drag and drop
- `iosMath.xcodeproj` onto your project or workspace (use the
-"Product Navigator view").
-3. Select your target and go to the Build phases tab. In the Link Binary
- With Libraries section select the add button. On the sheet find and
-add `libIosMath.a`. You might also need to add `iosMath` to
-the Target Dependencies list.
-4. Add the `MathFontBundle` to the list of `Copy Bundle Resources`.
-5. Include IosMath wherever you need it with `#import `.
-
-## Usage
-
-The library provides a class `MTMathUILabel` which is a `UIView` that
-supports rendering math equations. To display an equation simply create
-an `MTMathUILabel` as follows:
-
-```objective-c
-#import "MTMathUILabel.h"
-
-MTMathUILabel* label = [[MTMathUILabel alloc] init];
-label.latex = @"x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}";
-
-```
-Adding `MTMathUILabel` as a sub-view of your `UIView` as will render the
-quadratic formula example shown above.
-
-### Included Features
-This is a list of formula types that the library currently supports:
-
-* Simple algebraic equations
-* Fractions and continued fractions
-* Exponents and subscripts
-* Trigonometric formulae
-* Square roots and n-th roots
-* Calculus symbos - limits, derivatives, integrals
-* Big operators (e.g. product, sum)
-* Big delimiters (using \\left and \\right)
-* Greek alphabet
-* Combinatorics (\\binom, \\choose etc.)
-* Geometry symbols (e.g. angle, congruence etc.)
-* Ratios, proportions, percents
-* Math spacing
-* Overline and underline
-* Math accents
-* Matrices
-* Equation alignment
-* Change bold, roman, caligraphic and other font styles (\\bf, \\text, etc.)
-* Most commonly used math symbols
-* Colors
-
-### Example
-
-There is a sample app included in this project that shows how to use the
-app and the different equations that you can render. To run the sample
-app, clone the repository, and run `pod install` first. Then on iOS run the
-__iosMathExample__ app. For MacOS run the __MacOSMath__ app.
-
-### Advanced configuration
-
-`MTMathUILabel` supports some advanced configuration options:
-
-##### Math mode
-
-You can change the mode of the `MTMathUILabel` between Display Mode
-(equivalent to `$$` or `\[` in LaTeX) and Text Mode (equivalent to `$`
-or `\(` in LaTeX). The default style is Display. To switch to Text
-simply:
-
-```objective-c
-label.labelMode = kMTMathUILabelModeText;
-```
-
-##### Text Alignment
-The default alignment of the equations is left. This can be changed to
-center or right as follows:
-
-```objective-c
-label.textAlignment = kMTTextAlignmentCenter;
-```
-
-##### Font size
-The default font-size is 20pt. You can change it as follows:
-
-```objective-c
-label.fontSize = 30;
-```
-##### Font
-The default font is *Latin Modern Math*. This can be changed as:
-
-```objective-c
-label.font = [[MTFontManager fontManager] termesFontWithSize:20];
-```
-
-This project has 3 fonts bundled with it, but you can use any OTF math
-font.
-
-##### Color
-The default color of the rendered equation is black. You can change
-it to any other color as follows:
-
-```objective-c
-label.textColor = [UIColor redColor];
-```
-
-It is also possible to set different colors for different parts of the
-equation. Just access the `displayList` field and set the `textColor`
-on the underlying displays that you want to change the color of.
-
-##### Custom Commands
-You can define your own commands that are not already predefined. This is
-similar to macros is LaTeX. To define your own command use:
-
-```objective-c
-[MTMathAtomFactory addLatexSymbol:@"lcm"
- value:[MTMathAtomFactory operatorWithName:@"lcm" limits:NO]];
-```
-
-This creates a `\lcm` command that can be used in the LaTeX.
-
-##### Content Insets
-The `MTMathUILabel` has `contentInsets` for finer control of placement of the
-equation in relation to the view.
-
-If you need to set it you can do as follows:
-
-```objective-c
-label.contentInsets = UIEdgeInsetsMake(0, 10, 0, 20);
-```
-
-##### Error handling
-
-If the LaTeX text given to `MTMathUILabel` is
-invalid or if it contains commands that aren't currently supported then
-an error message will be displayed instead of the label.
-
-This error can be programmatically retrieved as `label.error`. If you
-prefer not to display anything then set:
-
-```objective-c
-label.displayErrorInline = NO;
-```
-
-## Future Enhancements
-
-Note this is not a complete implementation of LaTeX math mode. There are
-some important pieces that are missing and will be included in future
-updates. This includes:
-
-* Support for explicit big delimiters (bigl, bigr etc.)
-* Addition of missing plain TeX commands
-
-## Related Projects
-
-For people looking for things beyond just rendering math, there are two
-related projects:
-
-* [MathEditor](https://github.com/kostub/MathEditor): A WYSIWYG editor
- for math equations on iOS.
-* [MathSolver](https://github.com/kostub/MathSolver): A library for
- solving math equations.
-
-## License
-
-iosMath is available under the MIT license. See the [LICENSE](./LICENSE)
-file for more info.
-
-### Fonts
-This distribution contains the following fonts. These fonts are
-licensed as follows:
-* Latin Modern Math:
- [GUST Font License](./fonts/GUST-FONT-LICENSE.txt)
-* Tex Gyre Termes:
- [GUST Font License](./fonts/GUST-FONT-LICENSE.txt)
-* [XITS Math](https://github.com/khaledhosny/xits-math):
- [Open Font License](./fonts/OFL.txt)
diff --git a/iosMath/fonts b/iosMath/fonts
new file mode 120000
index 00000000..35bed8b8
--- /dev/null
+++ b/iosMath/fonts
@@ -0,0 +1 @@
+../fonts
\ No newline at end of file
diff --git a/iosMath/include/MTConfig.h b/iosMath/include/MTConfig.h
new file mode 120000
index 00000000..119c570a
--- /dev/null
+++ b/iosMath/include/MTConfig.h
@@ -0,0 +1 @@
+../render/MTConfig.h
\ No newline at end of file
diff --git a/iosMath/include/MTFont+Internal.h b/iosMath/include/MTFont+Internal.h
new file mode 120000
index 00000000..0d252e26
--- /dev/null
+++ b/iosMath/include/MTFont+Internal.h
@@ -0,0 +1 @@
+../render/internal/MTFont+Internal.h
\ No newline at end of file
diff --git a/iosMath/include/MTFont.h b/iosMath/include/MTFont.h
new file mode 120000
index 00000000..e8fdb667
--- /dev/null
+++ b/iosMath/include/MTFont.h
@@ -0,0 +1 @@
+../render/MTFont.h
\ No newline at end of file
diff --git a/iosMath/include/MTFontManager.h b/iosMath/include/MTFontManager.h
new file mode 120000
index 00000000..c4941cd9
--- /dev/null
+++ b/iosMath/include/MTFontManager.h
@@ -0,0 +1 @@
+../render/MTFontManager.h
\ No newline at end of file
diff --git a/iosMath/include/MTFontMathTable.h b/iosMath/include/MTFontMathTable.h
new file mode 120000
index 00000000..2619dc38
--- /dev/null
+++ b/iosMath/include/MTFontMathTable.h
@@ -0,0 +1 @@
+../render/internal/MTFontMathTable.h
\ No newline at end of file
diff --git a/iosMath/include/MTLabel.h b/iosMath/include/MTLabel.h
new file mode 120000
index 00000000..93f4a9b4
--- /dev/null
+++ b/iosMath/include/MTLabel.h
@@ -0,0 +1 @@
+../render/MTLabel.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathAtomFactory.h b/iosMath/include/MTMathAtomFactory.h
new file mode 120000
index 00000000..1da410f8
--- /dev/null
+++ b/iosMath/include/MTMathAtomFactory.h
@@ -0,0 +1 @@
+../lib/MTMathAtomFactory.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathList.h b/iosMath/include/MTMathList.h
new file mode 120000
index 00000000..2b7b4b7b
--- /dev/null
+++ b/iosMath/include/MTMathList.h
@@ -0,0 +1 @@
+../lib/MTMathList.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathListBuilder.h b/iosMath/include/MTMathListBuilder.h
new file mode 120000
index 00000000..60b60d7a
--- /dev/null
+++ b/iosMath/include/MTMathListBuilder.h
@@ -0,0 +1 @@
+../lib/MTMathListBuilder.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathListDisplay.h b/iosMath/include/MTMathListDisplay.h
new file mode 120000
index 00000000..006d9f91
--- /dev/null
+++ b/iosMath/include/MTMathListDisplay.h
@@ -0,0 +1 @@
+../render/MTMathListDisplay.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathListDisplayInternal.h b/iosMath/include/MTMathListDisplayInternal.h
new file mode 120000
index 00000000..b12bb951
--- /dev/null
+++ b/iosMath/include/MTMathListDisplayInternal.h
@@ -0,0 +1 @@
+../render/internal/MTMathListDisplayInternal.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathListIndex.h b/iosMath/include/MTMathListIndex.h
new file mode 120000
index 00000000..098c9d82
--- /dev/null
+++ b/iosMath/include/MTMathListIndex.h
@@ -0,0 +1 @@
+../lib/MTMathListIndex.h
\ No newline at end of file
diff --git a/iosMath/include/MTMathUILabel.h b/iosMath/include/MTMathUILabel.h
new file mode 120000
index 00000000..3fc02ea6
--- /dev/null
+++ b/iosMath/include/MTMathUILabel.h
@@ -0,0 +1 @@
+../render/MTMathUILabel.h
\ No newline at end of file
diff --git a/iosMath/include/MTTypesetter.h b/iosMath/include/MTTypesetter.h
new file mode 120000
index 00000000..af11a006
--- /dev/null
+++ b/iosMath/include/MTTypesetter.h
@@ -0,0 +1 @@
+../render/internal/MTTypesetter.h
\ No newline at end of file
diff --git a/iosMath/include/MTUnicode.h b/iosMath/include/MTUnicode.h
new file mode 120000
index 00000000..7db786f6
--- /dev/null
+++ b/iosMath/include/MTUnicode.h
@@ -0,0 +1 @@
+../lib/MTUnicode.h
\ No newline at end of file
diff --git a/iosMath/include/NSBezierPath+addLineToPoint.h b/iosMath/include/NSBezierPath+addLineToPoint.h
new file mode 120000
index 00000000..22a4c30a
--- /dev/null
+++ b/iosMath/include/NSBezierPath+addLineToPoint.h
@@ -0,0 +1 @@
+../render/NSBezierPath+addLineToPoint.h
\ No newline at end of file
diff --git a/iosMath/include/NSColor+HexString.h b/iosMath/include/NSColor+HexString.h
new file mode 120000
index 00000000..1cfa77ed
--- /dev/null
+++ b/iosMath/include/NSColor+HexString.h
@@ -0,0 +1 @@
+../render/NSColor+HexString.h
\ No newline at end of file
diff --git a/iosMath/include/NSView+backgroundColor.h b/iosMath/include/NSView+backgroundColor.h
new file mode 120000
index 00000000..89b56137
--- /dev/null
+++ b/iosMath/include/NSView+backgroundColor.h
@@ -0,0 +1 @@
+../render/NSView+backgroundColor.h
\ No newline at end of file
diff --git a/iosMath/include/UIColor+HexString.h b/iosMath/include/UIColor+HexString.h
new file mode 120000
index 00000000..1e73541c
--- /dev/null
+++ b/iosMath/include/UIColor+HexString.h
@@ -0,0 +1 @@
+../render/UIColor+HexString.h
\ No newline at end of file
diff --git a/iosMath/render/MTFont.m b/iosMath/render/MTFont.m
index b6e64f37..25a6b1d1 100644
--- a/iosMath/render/MTFont.m
+++ b/iosMath/render/MTFont.m
@@ -48,6 +48,9 @@ - (instancetype)initFontWithName:(NSString *)name size:(CGFloat)size
+ (NSBundle*) fontBundle
{
+#ifdef SWIFTPM_MODULE_BUNDLE
+ return SWIFTPM_MODULE_BUNDLE;
+#endif
// Uses bundle for class so that this can be access by the unit tests.
return [NSBundle bundleWithURL:[[NSBundle bundleForClass:[self class]] URLForResource:@"mathFonts" withExtension:@"bundle"]];
}
diff --git a/iosMath/render/UIColor+HexString.h b/iosMath/render/UIColor+HexString.h
index 0f844094..802a3070 100644
--- a/iosMath/render/UIColor+HexString.h
+++ b/iosMath/render/UIColor+HexString.h
@@ -7,7 +7,7 @@
//
#if TARGET_OS_IPHONE
-
+@import UIKit;
@interface UIColor (HexString)
+ (UIColor *)colorFromHexString:(NSString *)hexString;