From 810c5fb2e814ee22407da087db0342a7e76e56cd Mon Sep 17 00:00:00 2001 From: Haik Aslanyan Date: Mon, 27 Jan 2020 21:51:00 +0400 Subject: [PATCH] added framework files --- .gitignore | 71 ++----------------- Package.swift | 13 ++++ README.md | 4 +- Sources/Internal/RCCoder.swift | 29 ++++++++ Sources/Public/RCCameraViewController.swift | 31 ++++++++ .../RCCameraViewControllerDelegate.swift | 36 ++++++++++ Sources/Public/RCError.swift | 28 ++++++++ Sources/Public/RCImage.swift | 41 +++++++++++ Sources/Public/RCManager.swift | 36 ++++++++++ Tests/LinuxMain.swift | 7 ++ Tests/RoundCodeTests/RoundCodeTests.swift | 15 ++++ Tests/RoundCodeTests/XCTestManifests.swift | 9 +++ 12 files changed, 252 insertions(+), 68 deletions(-) create mode 100644 Package.swift create mode 100644 Sources/Internal/RCCoder.swift create mode 100644 Sources/Public/RCCameraViewController.swift create mode 100644 Sources/Public/RCCameraViewControllerDelegate.swift create mode 100644 Sources/Public/RCError.swift create mode 100644 Sources/Public/RCImage.swift create mode 100644 Sources/Public/RCManager.swift create mode 100644 Tests/LinuxMain.swift create mode 100644 Tests/RoundCodeTests/RoundCodeTests.swift create mode 100644 Tests/RoundCodeTests/XCTestManifests.swift diff --git a/.gitignore b/.gitignore index 312d1f6..95c4320 100644 --- a/.gitignore +++ b/.gitignore @@ -1,68 +1,5 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 +.DS_Store +/.build +/Packages +/*.xcodeproj xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint - -## Obj-C/Swift specific -*.hmap -*.ipa -*.dSYM.zip -*.dSYM - -## Playgrounds -timeline.xctimeline -playground.xcworkspace - -# Swift Package Manager -# -# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. -# Packages/ -# Package.pins -# Package.resolved -.build/ - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..d794429 --- /dev/null +++ b/Package.swift @@ -0,0 +1,13 @@ +// swift-tools-version:5.1 + +import PackageDescription + +let package = Package( + name: "RoundCode", + platforms: [.iOS(.v11)], + products: [.library(name: "RoundCode",targets: ["RoundCode"])], + targets: [ + .target(name: "RoundCode", dependencies: [], path: "Sources"), + .testTarget(name: "RoundCodeTests",dependencies: ["RoundCode"], path: "Tests") + ] +) diff --git a/README.md b/README.md index c2622fb..307ca26 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# roundCode \ No newline at end of file +# RoundCode + +A description of this package. diff --git a/Sources/Internal/RCCoder.swift b/Sources/Internal/RCCoder.swift new file mode 100644 index 0000000..6486b47 --- /dev/null +++ b/Sources/Internal/RCCoder.swift @@ -0,0 +1,29 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import Foundation + +class RCCoder { + + + +} diff --git a/Sources/Public/RCCameraViewController.swift b/Sources/Public/RCCameraViewController.swift new file mode 100644 index 0000000..31dc665 --- /dev/null +++ b/Sources/Public/RCCameraViewController.swift @@ -0,0 +1,31 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import UIKit + +public class RCCameraViewController: UIViewController, UIImagePickerControllerDelegate { + + public weak var delegate: RCCameraViewControllerDelegate? + + + +} diff --git a/Sources/Public/RCCameraViewControllerDelegate.swift b/Sources/Public/RCCameraViewControllerDelegate.swift new file mode 100644 index 0000000..c17cb48 --- /dev/null +++ b/Sources/Public/RCCameraViewControllerDelegate.swift @@ -0,0 +1,36 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import Foundation + +public protocol RCCameraViewControllerDelegate: class { + + func cameraViewController(_ controller: RCCameraViewController, didFinishPickingScanning data: String) + func cameraViewControllerDidCancel(_ controller: RCCameraViewController) + +} + +public extension RCCameraViewControllerDelegate { + + func cameraViewControllerDidCancel(_ controller: RCCameraViewController) {} + +} diff --git a/Sources/Public/RCError.swift b/Sources/Public/RCError.swift new file mode 100644 index 0000000..dc47819 --- /dev/null +++ b/Sources/Public/RCError.swift @@ -0,0 +1,28 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import Foundation + +public enum RCError: Error { + + +} diff --git a/Sources/Public/RCImage.swift b/Sources/Public/RCImage.swift new file mode 100644 index 0000000..9e28455 --- /dev/null +++ b/Sources/Public/RCImage.swift @@ -0,0 +1,41 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import UIKit + +public class RCImage { + + public var message = "" + public var type = ImageType.png + public var size = CGSize(width: 300, height: 300) + public var tintColor = UIColor.purple + public var attachmentImage: UIImage? + public var isTransparent = false + +} + +public extension RCImage { + enum ImageType { + case png + case jpg(quality: Double) + } +} diff --git a/Sources/Public/RCManager.swift b/Sources/Public/RCManager.swift new file mode 100644 index 0000000..d108ce4 --- /dev/null +++ b/Sources/Public/RCManager.swift @@ -0,0 +1,36 @@ +// MIT License + +// Copyright (c) 2020 Haik Aslanyan + +// 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. + +import UIKit +import CoreImage + +public class RCManager { + + public func encode(_ image: RCImage) throws -> UIImage { + return UIImage() + + } + + public func decode(_ data: UIImage) throws -> String { + return "" + } +} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..72df49b --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import RoundCodeTests + +var tests = [XCTestCaseEntry]() +tests += RoundCodeTests.allTests() +XCTMain(tests) diff --git a/Tests/RoundCodeTests/RoundCodeTests.swift b/Tests/RoundCodeTests/RoundCodeTests.swift new file mode 100644 index 0000000..da837db --- /dev/null +++ b/Tests/RoundCodeTests/RoundCodeTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import RoundCode + +final class RoundCodeTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(RoundCode().text, "Hello, World!") + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/Tests/RoundCodeTests/XCTestManifests.swift b/Tests/RoundCodeTests/XCTestManifests.swift new file mode 100644 index 0000000..3f6e26a --- /dev/null +++ b/Tests/RoundCodeTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(RoundCodeTests.allTests), + ] +} +#endif