Swift Class/Protocol is not recognised by Xcode compiler or Auto Complete

When you create a new file in your Swift Xcode project, e.g.: a new class. It gets created successfully however it seems unable to be used or found in the auto complete. Eg: I create a class FooBase and then try and create a second class that inherits from FooBase –

Class Foo:FooBase  

FooBase does not appear in the auto complete and the compiler throws an unknown type error.

  • jQuery click events not working in iOS
  • POST and PUT request AFNetworking
  • How to check if CMTime is valid in Swift?
  • Date Format in Swift
  • Simulate UIScrollView Deceleration
  • SpriteKit scene screen offset on iOS9 / Xcode7
  • Steps to Reproduce:
    1) File -> New File -> Create a FooBase.swift
    2) File -> New File -> Create a Foo.swift
    3) Try and inherit FooBase in Foo. Eg: Class Foo:FooBase

    Other classes I have created are in the autocomplete list, and can be picked, as are the base strings/ints etc.

    Its driving me mad. It seems to happen fairly randomly and about 80% of the time. Am I doing something stupid?

    3 Solutions Collect From Internet About “Swift Class/Protocol is not recognised by Xcode compiler or Auto Complete”

    Reading the steps you’ve listed, it seems that you created a swift file FooBase, but left it empty. Is there a class declaration in FooBase.swift?

    A .swift file doesn’t imply that you’ve created a class. 😉

    This works for me:

    import Foundation
    class FooBase {
        var fooBar = 1
    import Foundation
    class Foo: FooBase {
        let foo = FooBase().fooBar

    Note that the code completion did not pop up with FooBase when I was typing class Foo: FooBase. But it recognized it once I finished. You could out both classes in the same file for ease of demonstrating.

    This seems to be an issue with OS X Yosemite Beta. I’ve subsquently tried it in OS X Mavericks and I don’t get the issue.