O'Reilly logo

Mastering Swift 3 - Linux by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Cpcap module

Now that the module has been created, let's look at how we would use it in a project. The first thing we will need to do is to create a new project. The following commands will set up a new project named pcapProject:

mkdir pcapProject
cd pcapProject
swift package init

Now that the directory structure for our project has been created, we need to tell the compiler to use the newly created Cpcap module. To do this, we will need to add a dependency to the Package.swift file. The following code will define our application and also its dependency on the Cpcap module:

import PackageDescription   
let package = Package(      
    name: "pcapProject",      
    dependencies: [.Package(url: "../Cpcap", majorVersion: 0, minor: 1)] 
) 

We add the dependency ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required