diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..5dbdb4f --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,19 @@ +name: Swift + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + run: swift build -v + - name: Run tests + run: swift test -v diff --git a/.swift-version b/.swift-version index bf77d54..ef425ca 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.2 +5.2 diff --git a/Drawsana/Tools/Implementations/Text tool/TextTool.swift b/Drawsana/Tools/Implementations/Text tool/TextTool.swift index 5ed734b..48ace64 100644 --- a/Drawsana/Tools/Implementations/Text tool/TextTool.swift +++ b/Drawsana/Tools/Implementations/Text tool/TextTool.swift @@ -238,7 +238,7 @@ public class TextTool: NSObject, DrawingTool { func updateTextView() { guard let shape = selectedShape else { return } - editingView.textView.text = shape.text + // editingView.textView.text = shape.text editingView.textView.font = shape.font editingView.textView.textColor = shape.fillColor editingView.bounds = shape.boundingRect @@ -322,7 +322,11 @@ public class TextTool: NSObject, DrawingTool { extension TextTool: UITextViewDelegate { public func textViewDidChange(_ textView: UITextView) { guard let shape = selectedShape else { return } - shape.text = textView.text ?? "" + + if textView.markedTextRange == nil { + shape.text = textView.text ?? "" + } + updateShapeFrame() // TODO: Only update selection rect here instead of rerendering everything shapeUpdater?.rerenderAllShapesInefficiently() diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..6bfcec9 --- /dev/null +++ b/Package.swift @@ -0,0 +1,26 @@ +// swift-tools-version:5.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "Drawsana", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "Drawsana", + targets: ["Drawsana"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "Drawsana", + dependencies: [], + path: "Drawsana"), + ] +)