From a8761795022810bae2a06dd828a68169adb0311b Mon Sep 17 00:00:00 2001 From: Fumiya Tanaka Date: Mon, 30 Sep 2024 02:15:29 +0900 Subject: [PATCH] Update README.md (#60) * Update README.md * style: Apply format * chore: Update README --- .../GenerateOutputView+iOS.swift | 6 +- .../GenerateOutputView+macOS.swift | 3 +- .../GeneratePreviewView.swift | 6 +- README.md | 59 ++++++++++++------- Tests/Csv2ImgTests/ImageMakerTests.swift | 3 +- Tests/Csv2ImgTests/PdfMakerTests.swift | 5 +- 6 files changed, 50 insertions(+), 32 deletions(-) diff --git a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+iOS.swift b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+iOS.swift index 0b0e559..4315523 100644 --- a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+iOS.swift +++ b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+iOS.swift @@ -50,9 +50,9 @@ import SwiftUI Text(encoding.description).tag(encoding) } } - + if model.state.exportType == .pdf { - + Picker( "PDF Size", selection: Binding( @@ -64,7 +64,7 @@ import SwiftUI Text(size.rawValue).tag(size) } } - + Picker( "PDF Orientation", selection: Binding( diff --git a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+macOS.swift b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+macOS.swift index ef9067f..8399b46 100644 --- a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+macOS.swift +++ b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GenerateOutputView+macOS.swift @@ -48,7 +48,8 @@ import SwiftUI } } Picker("PDF Orientation", selection: $model.state.orientation) { - ForEach(PdfSize.Orientation.allCases, id: \.self) { orientation in + ForEach(PdfSize.Orientation.allCases, id: \.self) { + orientation in Text(orientation.rawValue).tag(orientation) } } diff --git a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GeneratePreviewView.swift b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GeneratePreviewView.swift index 7d4fa2f..e7ef6a7 100644 --- a/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GeneratePreviewView.swift +++ b/Csv2ImageApp/Csv2ImageApp/Views/GenerateOutputView/GeneratePreviewView.swift @@ -29,8 +29,7 @@ struct GeneratePreviewView: View { .aspectRatio(contentMode: .fit) .frame(width: geometry.size.width, height: geometry.size.height) } - } else if model.state.pdfDocument != nil, model.state.exportType == .pdf - { + } else if model.state.pdfDocument != nil, model.state.exportType == .pdf { PdfDocumentView( document: $model.state.pdfDocument, size: CGSize( @@ -58,8 +57,7 @@ struct GeneratePreviewView: View { .aspectRatio(contentMode: .fit) .frame(width: geometry.size.width, height: geometry.size.height) } - } else if model.state.pdfDocument != nil, model.state.exportType == .pdf - { + } else if model.state.pdfDocument != nil, model.state.exportType == .pdf { PdfDocumentView( document: $model.state.pdfDocument, size: CGSize( diff --git a/README.md b/README.md index 7a44969..36270c7 100644 --- a/README.md +++ b/README.md @@ -8,30 +8,23 @@ Convert Csv into png image. -## iOS App +## Demo +### iOS App -### Demo +https://github.com/user-attachments/assets/a9a7847e-7edc-4e28-b918-66de4b992aa3 +### MacOS App - - - - - - - - - -## MacOS App - -### Demo - - - +https://github.com/user-attachments/assets/9b6f5064-ab6e-4897-a0ab-cf5f104e3bbe +# Installation +Add the following to your `Package.swift` file: +```swift +.package(url: "https://github.com/fummicc1/csv2img.git", from: "1.9.0"), +``` # Csv2Img (Library) @@ -39,7 +32,15 @@ Convert Csv into png image. - [documentation](https://fummicc1.github.io/csv2img/documentation/csv2img/) -## Usage +## Installation of Csv2Img + +Add the following to your `Package.swift` file: + +```swift +.product(name: "Csv2Img", package: "csv2img"), +``` + +## Usage of Csv2Img You cloud convert csv into image / pdf in 3 ways. @@ -112,7 +113,7 @@ let data = try await csv.generate(fontSize: 12, exportType: .png) | 10 | 11 | 12 | ``` -#### Output Image +### Output Image ![sample](https://user-images.githubusercontent.com/44002126/186811765-ecc16ca5-9121-47ee-a5a6-a51ac181abd5.png) @@ -120,7 +121,15 @@ let data = try await csv.generate(fontSize: 12, exportType: .png) A helper library to generate `Csv` in Csv2Img library. -## How to use +## Installation of CsvBuilder + +Add the following to your `Package.swift` file: + +```swift +.product(name: "CsvBuilder", package: "csv2img"), +``` + +## Usage of CsvBuilder 1. Define custom type that conforms to `CsvComposition`. @@ -168,7 +177,15 @@ A command line tool which generates png-image from csv. (Using `Csv2Img` library - [documentation](https://fummicc1.github.io/Csv2ImgCmd_DocC/documentation/csv2imgcmd/) -## Usage +## Installation of Csv2ImgCmd + +Add the following to your `Package.swift` file: + +```swift +.product(name: "Csv2ImgCmd", package: "csv2img"), +``` + +## Usage of Csv2ImgCmd Coomand line interface using `Csv2Img` library. diff --git a/Tests/Csv2ImgTests/ImageMakerTests.swift b/Tests/Csv2ImgTests/ImageMakerTests.swift index aee5efa..42809cc 100644 --- a/Tests/Csv2ImgTests/ImageMakerTests.swift +++ b/Tests/Csv2ImgTests/ImageMakerTests.swift @@ -1,4 +1,5 @@ import XCTest + @testable import Csv2Img class ImageMakerTests: XCTestCase { @@ -20,7 +21,7 @@ class ImageMakerTests: XCTestCase { Csv.Column.Style(color: Color.blue.cgColor), Csv.Column.Style(color: Color.blue.cgColor), Csv.Column.Style(color: Color.blue.cgColor), - Csv.Column.Style(color: Color.blue.cgColor) + Csv.Column.Style(color: Color.blue.cgColor), ] ) let imageMaker = ImageMaker(maximumRowCount: nil, fontSize: 12) diff --git a/Tests/Csv2ImgTests/PdfMakerTests.swift b/Tests/Csv2ImgTests/PdfMakerTests.swift index 9458f2c..06bed80 100644 --- a/Tests/Csv2ImgTests/PdfMakerTests.swift +++ b/Tests/Csv2ImgTests/PdfMakerTests.swift @@ -1,5 +1,6 @@ -import XCTest import PDFKit +import XCTest + @testable import Csv2Img class PdfMakerTests: XCTestCase { @@ -19,7 +20,7 @@ class PdfMakerTests: XCTestCase { Csv.Column.Style(color: Color.blue.cgColor), Csv.Column.Style(color: Color.blue.cgColor), Csv.Column.Style(color: Color.blue.cgColor), - Csv.Column.Style(color: Color.blue.cgColor) + Csv.Column.Style(color: Color.blue.cgColor), ] ) let pdfMaker = PdfMaker(