concept default in category ios

appears as: default, default, defaults, The defaults, A default, defaults
iOS Development with Swift

This is an excerpt from Manning's book iOS Development with Swift.

You decide what files make up your project. Xcode starts off your project a certain way by default, but now you’re in control of the structure of your project. The yellow icons in the Project Navigator are called groups. You can (and should) group related items in your Project Navigator to keep your project neatly organized. As your project grows, a well-organized project becomes more and more essential!

  • Add a sort method to the BooksManager class to sort the array.
    func sort(books: inout [Book]) {              1
       books.sort(by: {                           2
           return $0.title < $1.title             3
       })
    }
    • 1 Declares parameter as inout
    • 2 Sorts books array
    • 3 Sorts based on title
    But what if two books have the same title? How can you also sort based on author as a secondary field? A solution for sorting two fields is to use a little tuple magic! Rather than comparing strings, you can compare tuples containing two strings.
    return ($0.title, $0.author) < ($1.title, $1.author)
    Another problem remains with this sort, however. Uppercase and lowercase characters are by default treated differently in comparisons, meaning that if the user enters a title beginning with a lowercase character, it will appear after all the other books. Furthermore, different locales have their own rules for sorting that must be considered. Fortunately, strings have a localizedLowercase property that’s a more appropriate version for comparisons.
  • Set the price tier of your app. If you’re feeling generous like me, set it to Free! The defaults will be fine for the other options. Select Save when you’re done (see figure 16.19). Below the Pricing and Availability tab, you’ll find a Platform Version Information tab, represented by a version number and the status of your app. You’ll probably see your app’s current version listed with 1.0 Prepare for Submission.
  • iOS 4 in Action: Developing iPhone and iPad Apps

    This is an excerpt from Manning's book iOS 4 in Action: Developing iPhone and iPad Apps.

    At this point, we should probably back up and explain the underlying way that iOS manages memory objects. It does so by maintaining a count of object usage. By default, it’s set to 1. Each retain message increases that count by 1, and each release message reduces that count by 1. When the count drops to 0, the memory for the object is freed up.

    Listing 19.8. Delegate methods for Store Kit
    - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { for (SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { case SKPaymentTransactionStatePurchased: [self completeTransaction:transaction]; break; case SKPaymentTransactionStateFailed: [self failedTransaction:transaction]; break; case SKPaymentTransactionStateRestored: [self restoreTransaction:transaction]; default: break; } } }

    When you set the category to playback, the system knows your application’s main purpose is to play music, and it should continue playing even when the application isn’t active. By default, this value in the audio session’s category is AVAudioSessionCategorySoloAmbient, and the system will stop the audio playing when the application is inactive. Because we’re building an audio-playing application that supports continuous audio playing in the background, we need to set the audio session category to playback.