Giter VIP home page Giter VIP logo

Comments (17)

vigneshuvi avatar vigneshuvi commented on May 25, 2024

Framework only supports array of JSON string and NSDictionary. Like below.

    let string = "[{\"a\":1,\"b\":2,\"c\":3},{\"a\":4,\"b\":5,\"c\":6}]";
    let filePath:String = exportCSV("userlist", fields:["a","b","c"], values:string);
    print(filePath)
    
    
    let fileDetails = readCSV(filePath);
    if fileDetails.allKeys.count > 0 {
        print(fileDetails)
    }
    
    // First Row Object
    let row1:NSMutableDictionary = NSMutableDictionary()
    row1.setValue(1, forKey: "a" );
    row1.setValue(2, forKey: "b" );
    row1.setValue(3, forKey: "c" );

    
    // Secound Row Object
    let row2:NSMutableDictionary = NSMutableDictionary()
    row2.setValue(4, forKey: "a" );
    row2.setValue(5, forKey: "b" );
    row2.setValue(6, forKey: "c" );
    
    // 3rd Row Object
    let row3:NSMutableDictionary = NSMutableDictionary()
    row3.setValue(7, forKey: "a" );
    row3.setValue(8, forKey: "b" );
    row3.setValue(9, forKey: "c" );

    
    // Add dictionary into rows of CSV Array
    let data:NSMutableArray  = NSMutableArray()
    data.add(row1);
    data.add(row2);
    data.add(row3);


    
    let path:String = SwiftCSVExport.exportCSV("numberList",fields: ["a", "b","c"],values: data);
    print(path)
    
    let numberDetails = readCSV(path);
    if numberDetails.allKeys.count > 0 {
        print(numberDetails)
    }

Sorry, You can use as like below as of now. I will do fix accordingly.

    let numberArray = [["a": 1, "b": 2, "c": 3],
        ["a": 4, "b": 5, "c": 6],
        ["a": 7, "b": 8, "c": 9]]
    
    // Add dictionary into rows of CSV Array
    let data:NSMutableArray  = NSMutableArray()
  
    let fields =  ["a", "b","c"];
    for dict in numberArray {
        let row:NSMutableDictionary = NSMutableDictionary()
        for i in 0 ..< fields.count {
            row.setValue(dict[fields[i]], forKey: fields[i] );
        }
        data.add(row)
    }
    
    let path:String = SwiftCSVExport.exportCSV("numberList",fields: fields,values: data);
    print(path)
    
    let numberDetails = readCSV(path);
    if numberDetails.allKeys.count > 0 {
        print(numberDetails)
    }

from swiftcsvexport.

JoshBoluga avatar JoshBoluga commented on May 25, 2024

Cool. Thanks.

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

Try with SwiftCSVExport (1.0.2)

from swiftcsvexport.

DogandElk avatar DogandElk commented on May 25, 2024
First Last Company Address1 Address2 City State Postalcode Country Sender Frontimage Backtext Accentimage Backimage    
Loma Linda Back Image Back Text 2nd Floor Mary Ann Missouri 64804 Fuller 4 States Printing Accent Image Record ID Rusty 12345678 Front Image United States 1234 Appaloosa Way

I'm getting strange formatting

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

New version 1.0.4 released.

Release Note: https://github.com/vigneshuvi/SwiftCSVExport/releases/tag/1.0.4

from swiftcsvexport.

kedolg avatar kedolg commented on May 25, 2024

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

@kedolg

I will look into your code again and let you know.

Can you please provide your "Backtext" string?

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

Hi @kedolg ,
You have used wrong field key to generate CSV file.

user1.setObject("Back Text", forKey: "BackText" as NSCopying);          //optional

  let filePath:String = SwiftCSVExport.exportCSV("userlist1",fields: ["DMID", "RecordID", "First", "Last", "Company","Address1", "Address2", "City", "State", "Postalcode", "Country", "Sender","Frontimage", "Backtext", "Accentimage","Backimage"],values: data);

"BackText" or "Backtext" ?

Note: Please maintain consistency between keys which you used in Dictionary and Field Array.

from swiftcsvexport.

kedolg avatar kedolg commented on May 25, 2024

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

@kedolg ,

Will work on punctuation staff and will release new build.

As of now, I have replaced "\n", "\t" and "\r" with empty string.

from swiftcsvexport.

kedolg avatar kedolg commented on May 25, 2024

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

@kedolg ,

I have handled the punctuation too! I will release version 1.0.5 by tomorrow.

Enjoy with my framework!

I'm from India, Tamil-nadu and my profile.

from swiftcsvexport.

kedolg avatar kedolg commented on May 25, 2024

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

Hi @kedolg & @DogandElk

🚀 SwiftCSVExport (1.0.5) successfully published
📅 November 7th, 21:07
🌎 https://cocoapods.org/pods/SwiftCSVExport

Release note

iCloud is big staff. We have to configure in developers account and so on!

Enable iCloud from here!

from swiftcsvexport.

DogandElk avatar DogandElk commented on May 25, 2024

from swiftcsvexport.

vigneshuvi avatar vigneshuvi commented on May 25, 2024

@DogandElk ,
Have you changed Podfile as like below?

pod 'SwiftCSVExport', :git => 'https://github.com/vigneshuvi/SwiftCSVExport.git', :tag => '1.0.4'
into
pod 'SwiftCSVExport'

screen shot 2017-11-08 at 11 33 43 am

from swiftcsvexport.

DogandElk avatar DogandElk commented on May 25, 2024

from swiftcsvexport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.