eonist / my-swift-projects

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

Many xCode warnings when building #7

Closed Joebayld closed 7 years ago

Joebayld commented 7 years ago

Hi,

I've noticed when trying to build this product that I'm thrown many issues. Most of them are from multiple objects conforming to the same protocol. There's also some other things that need to be addressed. Is this expected? Shall I create a PR? See attached screenshot.

issues
eonist commented 7 years ago

@Joebayld I will have a look.

eonist commented 7 years ago

@Joebayld Alright bumped the tag releases to use the latest code. Let me know if it's working. Are you using SPM or?

Joebayld commented 7 years ago

I'm using SPM. Got the new tag, it has fixes, but still a few things wrong. They are simple fixes though.

issues

if you use the following code, it will resolve the first error.

  private let eventCallback:FSEventStreamCallback = {(
      stream:ConstFSEventStreamRef, contextInfo:UnsafeMutableRawPointer?, numEvents:Int,
      eventPaths:UnsafeMutableRawPointer, eventFlags:UnsafePointer<FSEventStreamEventFlags>,
      eventIds:UnsafePointer<FSEventStreamEventId>
    ) in
    let fileSystemWatcher = Unmanaged<FileWatcher>.fromOpaque(contextInfo!).takeUnretainedValue()
    let paths = Unmanaged<CFArray>.fromOpaque(eventPaths).takeUnretainedValue() as! [String]

    for index in 0..<numEvents {
      fileSystemWatcher.callback?(FileWatcherEvent(eventIds[index], paths[index], eventFlags[index]))
    }
  }

On another note - is this meant to be built as a framework and used? Or should all the files live in my app project? When I run 'swift package generate-xcodeproj', it creates a Xcode framework project with all the code included. this is fine, however, nothing in Swift Utils is exposed public, so I can't really use the framework in another app. Would love to know how this should properly be used.

eonist commented 7 years ago

@Joebayld What Xcode are You running? 8.3.3 ? Ci travis doesn't display any warnings as of yesterday. I'm migrating to Xcode 9 pretty soon probably. And Nothing is Exposed, I use @testable import Utils instead. In the future I will break the library up into smaller pieces with proper exposure. Right now the framework is more "academic" and a way to organise my code / speed up build times. I made a tutorial series about how I use frameoworks that you can check out: http://eon.codes/blog/2017/02/25/The-ultimate-XCode-workflow/

Joebayld commented 7 years ago

Ah! I'm running it on Xcode 9. That likely explains it. Yeah it just looks like some API changes in 9.

Totally get it on the @testable. All good.

eonist commented 7 years ago

Moved to XCode 9 and swift 4. New release soon. Need to check if CI Travis is xcode 9 + swift ready