Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Beginning iPhone Development with Swift 3, Ch. 14, local version: Document not displayed

Ch. 14, local version (not with Cloud) compiles ok, new documents can be created, but they are not displayed when recalled from the table of documents.

What could be the reason for not showing the documents?

I am running OS Sierra 10.12.3 on my Mac Book Pro, Xcode 8.2, Swift 3.0.2
After seeing the code in the Book contains several errors, I used the latest release from the
examples directory: beg-iphone-dev-w-swift-3-1.0 

Any hint would be highly appreciated.

Werner

Comments

  • The problem appears to come from the fact the property "document" in class TinyPixView remains at nil.

    Where/when does that property get set up?

    Any hint welcome

    Werner


  • OK, I fixed it. Ch. 14 is working now in the local- as well as in the Cloud-version.
    The reason no document was drawn was because "prepare for segue" was not called.
    The reason it was not called is because its signature was wrong! ...sender needs to be Any? and not AnyObject?
    also if sender === self ... no longer works in Swift 3.1, I used a flag instead.
    (The "latest and greatest downloads" from the Apress-site are not maintained)

    For the cloud-version the biggest obstacle was to modify the downloaded code to the current Swift 3.1 syntax.
    (the compiler does not provide any hints in every case it detects an issue)

    So now I can create and modify documents between my iPhone and my iPad.

    The last bit needing work in order to make it "perfect" is to make toggling bits to work properly. As it stands now it is possible to set all 64 bits, but it is not possible to clear all 64 bits. You are always left with at least one bit set in every row. This was already the case in the version of the first printing of the book and Xcode 6.3, Swift 1.2!

    (my greatest wish is, that Apple bring back Snapshots to Xcode!)

Sign In or Register to comment.