Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully fledged example #10

Open
klaernie opened this issue Mar 11, 2022 · 2 comments
Open

Fully fledged example #10

klaernie opened this issue Mar 11, 2022 · 2 comments

Comments

@klaernie
Copy link

Hi there!

Could you please provide an example that shows an absolute swift beginner like myself how to do the most basic task?

My first attempt was literally copying the example from the README into a test.swift file, and handing that to swift: swift test.swift.
That of cause fails and complains:

/home/test.swift:1:12: error: cannot find 'Data' in scope
let data = Data(contentsOfFile: "ma_rules.rwz")!
           ^~~~
/home/test.swift:2:16: error: cannot find 'OutlookRulesFile' in scope
let file = try OutlookRulesFile(data: data)
               ^~~~~~~~~~~~~~~~

If you're wondering what I'm trying to accomplish:
I'd like to generally dump my way-too-big ruleset in a text format that is easy to read, so I can take a stab at reorganizing and making a more-understandable ruleset with less bugs.

Thanks and best regards,
Andre

@hughbe
Copy link
Owner

hughbe commented Mar 11, 2022

Hey Andre - looks like you’re missing some imports? Try including the following at the top of your file

import Foundation
import OutlookRulesReader

Also, the test project has some examples: e.g. https://github.com/hughbe/OutlookRulesReader/blob/master/Tests/OutlookRulesReaderTests/DumpFileTests.swift

@klaernie
Copy link
Author

Hi Hugh!

Thanks - but it only helps partially. I probably don't know how to tell swift where to find OutlookRulesReader, since it now complains

/home/OutlookRulesReader/test.swift:2:8: error: no such module 'OutlookRulesReader'
import OutlookRulesReader
       ^

I guess my assumption of just putting my test.swift file into the repo's main path is wrong, and trying to put it on the same level as the repo (so that test.swift and OutlookRulesReader/ are in the same directory) is also not fruitful.

Just to give you a hint: today is the first time I ever tried to use swift, I only grabbed your repo and the official swift docker container, and started copying from the README. So while I'm fairly confident I'll somehow manage the "outputting the interesting bits" (since that's just some for loops and print statements) I'm entirely lost at getting a more-than-hello-world running. Please excuse my stupidity.

Thanks,
Andre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants