-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add PlantUMLKeyboard local package
- Loading branch information
1 parent
26ca791
commit 0f3a449
Showing
7 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/config/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# PlantUMLKeyboard | ||
|
||
A description of this package. |
84 changes: 84 additions & 0 deletions
84
PlantUMLKeyboard/Sources/PlantUMLKeyboard/PlantUMLKeyboard.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
PlantUMLKeyboard/Tests/PlantUMLKeyboardTests/PlantUMLKeyboardTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!") | ||
} | ||
} |