title: The right workflow when editing class in GraphQL
body: <p>I am on xcode 11.4 and swift4, and I currently am working with AWS GraphQL and learning the proper workflow. My <code>amplify.xyz</code> config is set as</p>
  
  <pre><code>push=true
  modelgen=true
  profile=default
  envName=amplify
  </code></pre>
  
  <p>So that models are generated as they are created/edited. In <code>schema.graphql</code> I define user:</p>
  
  <pre><code>type User @model {
      id: ID!
      firstName  : String!
      lastName   : String!
      handle     : String!
      email      : String!
  }
  </code></pre>
  
  <p>And build/run the application, and am able to create/read an instance of <code>user</code> as expected. Then suppose I add a simple new field <code>User @model</code> so that I have:</p>
  
  <pre><code>type User @model {
      id: ID!
      firstName  : String!
      lastName   : String!
      handle     : String!
      email      : String!
      blank      : String!
  }
  </code></pre>
  
  <p>And then clean the build folder, and rebuild the application. I then get the inexplicable error </p>
  
  <pre><code>No such module 'Amplify' HomeController.swift
  </code></pre>
  
  <p>Even though changing the <code>Model</code> class and <code>Amplify</code> appear unrelated. If I remove <code>blank</code>, and clean and rebuild, things are normal again.  What is the reason for this behavior?</p>
  
  <p>For reference, here is my podfile:</p>
  
  <pre><code># Uncomment the next line to define a global platform for your project
  # platform :ios, '9.0'
  
  target 'alpha' do
    # Comment the next line if you don't want to use dynamic frameworks
    use_frameworks!
  
    # Pods for alpha
      pod 'amplify-tools'
  
      pod 'Amplify'
      pod 'AWSPluginsCore'
      pod 'AmplifyPlugins/AWSAPIPlugin'
  
      pod 'AWSMobileClient', '~&gt; 2.13.0'      # Required dependency
      pod 'AWSUserPoolsSignIn', '~&gt; 2.13.0'
  
      pod 'AWSAppSync', '~&gt; 3.1.0'
      pod 'AWSMobileClient', '~&gt; 2.13.0'
      pod 'AWSAuthUI', '~&gt; 2.13.0'
      pod 'AWSUserPoolsSignIn', '~&gt; 2.13.0'
  
  end
  </code></pre>
  
  <p>______________________ UPDATE ___________________</p>
  
  <p>I an <code>amplify push</code> as Julien S suggested, and make sure all the files in <code>amplify/generated/models</code> are moved to the top level directory per (<a href="https://aws-amplify.github.io/docs/ios/start?ref=amplify-iOS-btn" rel="nofollow noreferrer">https://aws-amplify.github.io/docs/ios/start?ref=amplify-iOS-btn</a>). Now this problem <code>No such module 'Amplify' HomeController.swift</code> is solved. However I can no longer find the data that was saved before the model was updated. For reference, when the user creates an account, I access the user's token and save it along with the user's email. Then next time the user opens the app, I get the token again and query the user db by token. Relevant code:</p>
  
  <pre><code>class CognitoPoolProvider : AWSCognitoUserPoolsAuthProviderAsync {
  
      func getLatestAuthToken(_ callback: @escaping (String?, Error?) -&gt; Void) {
  
          AWSMobileClient.default().getTokens { (token, error) in
              if let error = error {
                  callback(nil,error)
              }
              callback(token?.accessToken?.tokenString, error)
          }
      }
  }
  </code></pre>
  
  <p>In MainController.swift:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      // get user token
      let pool = CognitoPoolProvider();
  
      pool.getLatestAuthToken { (token, error) in
  
          if let error = error {
  
              print("error: \(error)")
  
          } else {
              self.getUserData(token: token!)
          }
      }
  }
  
  func getUserData(token:String){
  
      print("token &gt;&gt;&gt;&gt; \(token)")
  
     // this is successful. you got all the user stuff
     // when you change the user model, you can no longer query the user
     let _ = Amplify.API.query(from: User.self, byId: token) { (event) in
          switch event {
              case .completed(let result):
                  switch result {
                      case .success(let note):
                          guard let note = note else {
                              print("API Query completed but missing user")
                              return
                          }
                          print("API Query successful, got user: \(note)")
                  case .failure(let error):
                      print("Completed with error: \(error.errorDescription)")
                      }
              case .failed(let error):
                  print("Failed with error \(error.errorDescription)")
              default:
                  print("Unexpected event")
          }
      }
  
  }
  </code></pre>