diff --git a/PlantUML.xcodeproj/project.pbxproj b/PlantUML.xcodeproj/project.pbxproj index 1f20294..179edd3 100644 --- a/PlantUML.xcodeproj/project.pbxproj +++ b/PlantUML.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ A0D3C6C72898770F000838D7 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; A0D3C6C82898770F000838D7 /* NoLogger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoLogger.swift; sourceTree = ""; }; A0D3C71D28987D94000838D7 /* SwiftPlantUML.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = SwiftPlantUML.playground; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; + A0EF7AF128C40A6300660F09 /* PlantUMLKeyboard */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = PlantUMLKeyboard; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -178,6 +179,7 @@ A0D3C63D28984A0E000838D7 = { isa = PBXGroup; children = ( + A0EF7AF128C40A6300660F09 /* PlantUMLKeyboard */, A0C1657C289FD315004EB5C7 /* SwiftPlantUMLView.playground */, A0A42A7B289AD9FA00E929EB /* README.md */, A0D3C71D28987D94000838D7 /* SwiftPlantUML.playground */, diff --git a/PlantUML4iPad.xcworkspace/xcuserdata/bsorrentino.xcuserdatad/xcschemes/xcschememanagement.plist b/PlantUML4iPad.xcworkspace/xcuserdata/bsorrentino.xcuserdatad/xcschemes/xcschememanagement.plist index 267ad96..8cb27b8 100644 --- a/PlantUML4iPad.xcworkspace/xcuserdata/bsorrentino.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/PlantUML4iPad.xcworkspace/xcuserdata/bsorrentino.xcuserdatad/xcschemes/xcschememanagement.plist @@ -23,7 +23,7 @@ isShown orderHint - 5 + 1 SwiftPlantUMLView (Playground) 1.xcscheme @@ -44,7 +44,7 @@ isShown orderHint - 2 + 3 diff --git a/PlantUMLKeyboard/.gitignore b/PlantUMLKeyboard/.gitignore new file mode 100644 index 0000000..3b29812 --- /dev/null +++ b/PlantUMLKeyboard/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/PlantUMLKeyboard/Package.swift b/PlantUMLKeyboard/Package.swift new file mode 100644 index 0000000..4848f10 --- /dev/null +++ b/PlantUMLKeyboard/Package.swift @@ -0,0 +1,31 @@ +// swift-tools-version: 5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "PlantUMLKeyboard", + platforms: [ + .iOS(.v15) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "PlantUMLKeyboard", + targets: ["PlantUMLKeyboard"]), + ], + 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 this package depends on. + .target( + name: "PlantUMLKeyboard", + dependencies: []), + .testTarget( + name: "PlantUMLKeyboardTests", + dependencies: ["PlantUMLKeyboard"]), + ] +) diff --git a/PlantUMLKeyboard/README.md b/PlantUMLKeyboard/README.md new file mode 100644 index 0000000..615550f --- /dev/null +++ b/PlantUMLKeyboard/README.md @@ -0,0 +1,3 @@ +# PlantUMLKeyboard + +A description of this package. diff --git a/PlantUMLKeyboard/Sources/PlantUMLKeyboard/PlantUMLKeyboard.swift b/PlantUMLKeyboard/Sources/PlantUMLKeyboard/PlantUMLKeyboard.swift new file mode 100644 index 0000000..e4565d2 --- /dev/null +++ b/PlantUMLKeyboard/Sources/PlantUMLKeyboard/PlantUMLKeyboard.swift @@ -0,0 +1,84 @@ +import SwiftUI +import UIKit + + +struct PlantUMLKeyboardView: View { + + @Binding var show : Bool + @Binding var txt : String + + var body : some View{ + + ZStack(alignment: .topLeading) { + + ScrollView(.vertical, showsIndicators: false) { + + VStack(spacing: 15){ + + ForEach(self.getEmojiList(),id: \.self){i in + + HStack(spacing: 25){ + + ForEach(i,id: \.self){j in + + Button(action: { + + self.txt += String(UnicodeScalar(j)!) + + }) { + + if (UnicodeScalar(j)?.properties.isEmoji)!{ + + Text(String(UnicodeScalar(j)!)).font(.system(size: 55)) + } + else{ + + Text("") + } + } + } + } + } + } + .padding(.top) + + } + .frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height / 3) + .background(Color.white) + .cornerRadius(25) + + Button(action: { + self.show.toggle() + }) { + Image(systemName: "xmark").foregroundColor(.black) + } + .padding() + } + } + + func getEmojiList()->[[Int]]{ + + var emojis : [[Int]] = [] + + for i in stride(from: 0x1F601, to: 0x1F64F, by: 4){ + + var temp : [Int] = [] + + for j in i...i+3{ + + temp.append(j) + } + + emojis.append(temp) + } + + return emojis + } +} + + +struct PlantUMLKeyboardViewPreviews: PreviewProvider { + static var previews: some View { + PlantUMLKeyboardView( show: Binding.constant(true), txt: Binding.constant("TEST")) + } +} diff --git a/PlantUMLKeyboard/Tests/PlantUMLKeyboardTests/PlantUMLKeyboardTests.swift b/PlantUMLKeyboard/Tests/PlantUMLKeyboardTests/PlantUMLKeyboardTests.swift new file mode 100644 index 0000000..eb3bdd9 --- /dev/null +++ b/PlantUMLKeyboard/Tests/PlantUMLKeyboardTests/PlantUMLKeyboardTests.swift @@ -0,0 +1,11 @@ +import XCTest +@testable import PlantUMLKeyboard + +final class PlantUMLKeyboardTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + // XCTAssertEqual(PlantUMLKeyboardView().text, "Hello, World!") + } +}