eonist / my-swift-projects

An overview of my most relevant open-source projects on GitHub
263 stars 22 forks source link

Missing import in Align.swift #9

Open kimasendorf opened 5 years ago

kimasendorf commented 5 years ago

I added the swift-utils as submodule to a test project. When I simply try to compile it without writing any additional code I get a bunch of errors in ./swift-utils/Sources/Utils/misc/layout/alignment/Align.swift.

All the CG datatypes are undeclared.

I assume there is an import of Foundation missing.

eonist commented 5 years ago

@kimasendorf Sorry for not including Carthage or instructions on how to use it. Will add Carthage tomorrow.

So to get it running in 30sec what you do is:

http://eon.codes/blog/2017/11/08/local-frameworks/

Do Step 1 until 5. Just don't name it AwesomeLib, Name it Utils.

Let me know if you get stuck. I will try to help. πŸ‘

eonist commented 5 years ago

The reason we use .framework is so that you don't have to compile all the files on every run.

This library is meant more as a pick and choose lib. I use many parts of it in other projects. Almost never the whole thing. I have a Tester project that has the entire lib, for whenever I want to clean it up or add things.

kimasendorf commented 5 years ago

Hey, thanks for the info. Do you add each packages from their single repository? I saw their are many cross references. Will try the .framework wrapper, sounds useful =)

eonist commented 5 years ago

I break out libs on a need by need basis.

If you want to use the Constaint lib. You need Constraint.swift, Alignment.swift and ConstraintKind.swift. FYI: the constraint lib wil get its own repo soon, and will be re-branded to Spatial πŸŽ‰

If you just want to try the entire Utils lib out. You can just downloader and drag it into xcode. And start ising everything.

kimasendorf commented 5 years ago

Hey, thanks for the info. Do you add each packages from their single repository? I saw their are many cross references. Will try the .framework wrapper, sounds useful =)

kimasendorf commented 5 years ago

One more stupid question, which Swift version do you use?

eonist commented 5 years ago

There are no stupid questions πŸ˜‰. I USE the latest swift version so that should be 4.2. I just upgraded to Mojave so im not 100%

kimasendorf commented 5 years ago

I just installed High Sierra and Xcode 10.0. It comes with Swift 4.2.

I get many compiler errors.. Thought I have to use 4.1 but it seems really hard to get an older version working..

eonist commented 5 years ago

AS far AS i know there ahould not be huge differences in warnings between 4.1 and 4.2 i will give it a spin at the office today in Mojave. I’m still moving atom.io prefs and setting up My os config. So a bit behind atm.

eonist commented 5 years ago

@kimasendorf Alrighty, here we go. 4.2 πŸ”Έ I tested it in Mojave + Xcode 10.0 + swift 4.2 all tests run. https://github.com/eonist/swift-utils/commit/395e8b83575821efbd53736172f06e344d609da3

kimasendorf commented 5 years ago

Great! There is one error left in swift-utils/Sources/Utils/misc/layout/menu/CustomMenuItem.swift

override func validateMenuItem(_ menuItem:NSMenuItem) -> Bool { //override in subclass (optional) return true }

Method does not override any method from its superclass

kimasendorf commented 5 years ago

There are also still errors in swift-utils/Sources/Utils/text/utils/format/TextFormatUtils.swift

and in swift-utils/Sources/Utils/geom/path/ns/NSBezierPathParser.swift.

They are easy to fix..

However, I put all code in a framework but the framework just has an objective-c header file.. Do I need to create some sort of swift index file and import all file I need?

eonist commented 5 years ago

I will try to Add the code to a new project and see if there stil are bugs. Also I will make an on boarding wiki page with some gifs explaining the steps to build from frameowork. It’s dead simple but you have to sort of have an overview look.

kimasendorf commented 5 years ago

Thanks a lot =)

eonist commented 5 years ago

@kimasendorf Updated the files that threw an error and made better on boarding for using the lib, http://eon.codes/blog/2018/09/30/Manually-adding-a-lib/

Will update the build from framework article with gifs later today.

eonist commented 5 years ago

@kimasendorf As promised, I added gif videos the explains the steps to build from a framework file: http://eon.codes/blog/2017/11/08/local-frameworks/ in your case you would just need to name the target Utils and then use import Utils in subsequent code that wants to use the Utils code.

kimasendorf commented 5 years ago

Great, all errors are gone.

Still not able to get the framework approach right. I created a framework and added the utils, but I think it needs a root file or something?

eonist commented 5 years ago

If you do the steps in the local framwork article exactly AS they are sone in the GIFs it should work. This is how you would menes any framework, not just this.

kimasendorf commented 5 years ago

But in your post you just add a function to the framework and no files. I mean I've created a framework and added all files and wasn't able to use any func after import..

eonist commented 5 years ago

Notice that you have to prefix import with @testable. You also need reach the correct class/instance scope . I.e ArrayParser.count([7,9,7]) //output:3