Chapter 5 - No such module 'Game'

HI …!

In my project I get the following error:
Error list:
BullsEyePlus Group
Swift Compiler Error Group
/BullsEyePlus/BullsEyePlus/ContentView.swift:33:38: Use of unresolved identifier ‘BullsEyeGame’
BullsEyePlus WatchKit Extension Group
Swift Compiler Error Group
/ BullsEyePlus / BullsEyePlus WatchKit Extension / ContentView.swift: 33: 38: Use of unresolved identifier ‘BullsEyeGame’

After looking at the module of the game after clean, it looks like this:

import Combine
import Foundation
import SwiftOnoneSupport

If we build the bottom of the final, look inside the Game module

import Combine
import Foundation
import SwiftOnoneSupport
public class BullsEyeGame: ObservableObject {
// skip
}

It is different as above.
Why am I not created like a folder under final?

Why? “Use of unresolved identifier ‘BullsEyeGame’” Don’t know if you get this error?
please please! …
thank!

hi Hye Gon! if you’ve copied the project to another directory, you have to also copy the packages folder, to keep the directory structure the same. The project uses the Game package’s relative path, so it expects to find it in packages/Game, alongside the BullsEyePlus folder.

Hi … audrey.
The project only copied the project provided by ray to BullsEyePlus.
The package was created and included in the BullsEyePlus project.
Currently my folder structure is

/ ch05 / BullsEyePlus / BullsEyePlus /
/ ch05 / packages / Game
-/ch05/packages/Game/Sources/Game/BullsEyeGame.swift
/ ch05 / BullsEyePlus / BullsEyePlus WatchKit Extension

Error list
-BullsEyePlus
I / ch05 / BullsEyePlus / BullsEyePlus / ContentView.swift: 33: 38: Use of unresolved identifier ‘BullsEyeGame’
-BullsEyePlus WatchKit Extension
/ ch05 / BullsEyePlus / BullsEyePlus WatchKit Extension / ContentView.swift: 33: 38: Use of unresolved identifier ‘BullsEyeGame’

I created a new project and tested it again, but it’s still an error.
thank!

31

My Home computer …!

24

hi Hye Gon, those error messages don’t make sense, so restarting Xcode might help. Or restart your Mac. Also try deleting the Derived Data folder.

when the only error is a missing module for Game, you can usually get rid of it by just building the project. But those two WatchKit errors don’t make sense if you haven’t changed anything.

I guess you changed the bundle ID and signed with your team?

I was getting the exact same errors as hyegon. The problem was my BullsEyeGame.swift file was in the wrong folder in the Game package. I had to move it one level down in the directory structure from:

packages/Game/Sources/BullsEyeGame.swift

to

packages/Game/Sources/Game/BullsEyeGame.swift

Moving the file to the correct folder allowed me to build and continue.

thanks Brian! I’ll fix it for the next update

update: actually, it’s already in packages/Game/Sources/Game/ in my copy of both released versions :thinking:

My newly created and tested project path
package
/packages/Game/Sources/Game/BullsEyeGame.swift
Same as the path you said.

When you see the attached image …
See the path in show the file inspector, a panel in Xcode.
thank!
thank!27

@hyegon Do you still have issues with this?