Over the years, Mastering Swift has proven itself among developers as a popular choice for an in-depth and practical guide to the Swift programming language. This sixth edition comes with the latest features, an overall revision to align with Swift 5.3, and two new chapters on building swift from source and advanced operators.From the basics of the language to popular features such as concurrency, generics, and memory management, this in-depth guide will help you develop your expertise and mastery of the language.As you progress, you will gain practical insights into some of the most sophisticated elements in Swift development, including protocol extensions, error handling, and closures. The book will also show you how to use and apply them in your own projects. In later chapters, you will understand how to use the power of protocol-oriented programming to write flexible and easier-to-manage code in Swift. Finally, you will learn how to add the copy-on-write feature to your custom value types, along with understanding how to avoid memory management issues caused by strong reference cycles.By the end of this Swift book, you will have mastered the Swift 5.3 language and developed the skills you need to effectively use its features to build robust applications. Spis treści:PrefaceWho this book is forWhat this book coversTo get the most out of this bookDownload the example code filesDownload the color imagesConventions usedGet in touchReviewsTaking the First Steps with SwiftWhat is Swift?Swift featuresPlaygroundsGetting started with playgroundsiOS, tvOS, and macOS playgroundsCreating and displaying graphs in playgroundsWhat playgrounds are notSwift language syntaxCommentsSemicolonsParenthesesCurly bracketsAn assignment operator does not return a valueSpaces are optional in conditional and assignment statementsHello WorldSummarySwift Documentation and Installing SwiftSwift.orgSwift documentationInstalling Swift from swift.orgBuilding Swift and the Swift toolchain from sourceInstalling dependenciesSwift sourceBuilding SwiftInstalling SwiftTesting the installationUsing the Swift package managerUsing the Swift compilerSummaryLearning about Variables, Constants, Strings, and OperatorsConstants and variablesDefining constants and variablesType safetyType inferenceExplicit typesNumeric typesInteger typesFloating-point and Double valuesThe Boolean typeThe String typeTuplesEnumerationsOperatorsThe assignment operatorComparison operatorsArithmetic operatorsThe remainder operatorCompound assignment operatorsThe closed range operatorThe half-open range operatorThe ternary conditional operatorThe logical NOT operatorThe logical AND operatorThe logical OR operatorSummaryOptional TypesIntroducing optionalsThe need for optional types in SwiftDefining an optionalUsing optionalsForced unwrapping of an optionalOptional bindingOptional types with tuplesOptional chainingThe nil coalescing operatorSummaryUsing Swift CollectionsSwift collection typesMutabilityArraysCreating and initializing arraysAccessing the array elementCounting the elements of an arrayIs the array empty?Shuffling an arrayAppending to an arrayInserting a value into an arrayReplacing elements in an arrayRemoving elements from an arrayMerging two arraysRetrieving a subarray from an arrayMaking bulk changes to an arrayAlgorithms for arraysSortSortedFilterMapCountDiffforEachIterating over an arrayDictionariesCreating and initializing dictionariesAccessing dictionary valuesCounting the keys or values in a dictionaryIs the dictionary empty?Updating the value of a keyAdding a key-value pairRemoving a key-value pairSetInitializing a setInserting items into a setDetermining the number of items in a setChecking whether a set contains an itemIterating over a setRemoving items in a setSet operationsSummaryControl FlowWhat have we learned so far?Curly bracketsParenthesesControl flowConditional statementsThe if statementConditional code execution with the if…else statementThe guard statementThe switch statementMatch on wildcardLoopsThe for-in loopUsing the for-in loopThe while loopUsing the while loopUsing the repeat-while loopUsing case and where statements with conditional statements and loopsFiltering with the where statementFiltering with the for-case statementUsing the if-case statementControl transfer statementsThe continue statementThe break statementThe fallthrough statementSummaryFunctionsUsing a single-parameter functionUsing a multi-parameter functionDefining a parameters default valuesReturning multiple values from a functionAdding external parameter namesUsing variadic parametersinout parametersOmitting argument labelsPutting it all togetherSummaryClasses, Structures, and ProtocolsWhat are classes and structures?Similarities between classes and structuresDifferences between classes and structuresValue versus reference typesCreating a class or structurePropertiesStored propertiesComputed propertiesProperty observersMethodsCustom initializersInternal and external parameter namesFailable initializersAccess controlsKey-path expressions as functionsCalling a type as a functionInheritanceOverriding methods and propertiesOverriding methodsOverriding propertiesPreventing overridesProtocolsProtocol syntaxProperty requirementsMethod requirementsExtensionsProperty wrappersOptional chainingSummaryProtocols and Protocol ExtensionsProtocols as typesPolymorphism with protocolsTypecasting with protocolsProtocol extensionsA real-world exampleDo I need to use protocols?Adopting protocols using a synthesized implementationSwifts standard librarySummaryProtocol-Oriented DesignRequirementsObject-oriented designProtocol-oriented designProtocol inheritanceProtocol compositionProtocol-oriented design putting it all togetherUsing the where statement with protocolsStructures versus classesSummaryGenericsIntroducing genericsGeneric functionsGeneric typesConditionally adding extensions with genericsConditionally adding functionsConditional conformanceGeneric subscriptsAssociated typesSummaryError Handling and AvailabilityNative error handlingRepresenting errorsThrowing errorsCatching errorsMulti-pattern catch clausesThe availability attributeSummaryCustom SubscriptingIntroducing subscriptsSubscripts with Swift arraysCreating and using custom subscriptsRead-only custom subscriptsCalculated subscriptsSubscript valuesStatic subscriptsExternal names for subscriptsMultidimensional subscriptsDynamic member lookupWhen not to use a custom subscriptSummaryWorking with ClosuresAn introduction to closuresSimple closuresShorthand syntax for closuresUsing closures with Swift arraysUsing closures with Swifts array algorithmsNon-contiguous elements from an arrayUninitialized arraysChanging functionalitySelecting a closure based on resultsSummaryAdvanced and Custom OperatorsBits and bytesEndiannessBitwise operatorsPrinting binary numbersThe bitwise AND operatorThe bitwise OR operatorThe bitwise XOR operatorThe bitwise NOT operatorBitwise shift operatorsOverflow operatorsOperator methodsCustom operatorsSummaryConcurrency and Parallelism in SwiftConcurrency and parallelismGrand Central Dispatch (GCD)Calculation typesCreating queuesCreating and using a concurrent queueCreating and using a serial queueasync versus syncExecuting code on the main queue functionUsing asyncAfterUsing the Operation and OperationQueue typesUsing BlockOperationUsing the addOperation() method of the operation queueSubclassing the Operation classSummaryCustom Value TypesValue types and reference typesRecursive data types for reference typesInheritance for reference typesDynamic dispatchCopy-on-writeImplementing the Equatable protocolSummaryMemory ManagementHow ARC worksStrong reference cyclesUnowned referencesWeak referencesSummarySwift Formatting and Style GuideWhat is a programming style guide?API Design GuideYour style guideDo not use semicolons at the end of statementsDo not use parentheses for conditional statementsNamingIndentingCommentsUsing the self keywordConstants and variablesOptional typesUsing type inferenceUsing shorthand declarations for collectionsUsing switch rather than multiple if statementsDont leave commented-out code in your applicationSummaryAdopting Design Patterns in SwiftWhat are design patterns?Creational design patternsThe singleton patternUnderstanding the problemUnderstanding the solutionImplementing the singleton patternThe builder patternUnderstanding the problemUnderstanding the solutionImplementing the builder patternStructural design patternsThe bridge patternUnderstanding the problemUnderstanding the solutionImplementing the bridge patternThe facade patternUnderstanding the problemUnderstanding the solutionImplementing the facade patternThe proxy patternUnderstanding the problemUnderstanding the solutionImplementing the proxy patternBehavioral design patternsThe command patternUnderstanding the problemUnderstanding the solutionImplementing the command patternThe strategy patternUnderstanding the problemUnderstanding the solutionImplementing the strategy patternSummaryOther Books You May EnjoyIndex O autorze: Jon Hoffman od ponad ćwierćwiecza zajmuje się administrowaniem systemami i sieciami oraz ich bezpieczeństwem, a także tworzeniem aplikacji i architekturą systemów. Od 2008 roku tworzy oprogramowanie na platformę iOS. Jego prawdziwą pasją jest podejmowanie wyzwań w zakresie technologii informatycznych i oczywiście pokonywanie napotkanych problemów.

Kategoria: E-Beletrystyka

Producent:

pappa razzi, kici, hubal, maszyny do szycia singer, dekadencja, behemot

yyyyy