برچسب: Swift

  • Beginning iOS & Swift | Kodeco

    Beginning iOS & Swift | Kodeco


    We understand that circumstances can change, and if you need to withdraw from the bootcamp, your options will vary depending on your billing cycle:

    – If you enrolled with a monthly plan, you can cancel your future billing with your membership and you will not be renewed on your next billing date OR you can pause your membership for up to three months, then you can pick up your studies again at that time.

    – If you enrolled with a one-time payment, you will be eligible for a full refund within the first 14 days of your enrollment into the bootcamp.

    *Please note: if you’ve accessed a significant portion of program materials, this might affect your eligibility for a full refund.

    Please email support@kodeco.com for further assistance on the withdrawal process.



    Source link

  • Swift Apprentice: Beyond the Basics

    Swift Apprentice: Beyond the Basics


    This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

    The section is a list of the expanded areas of Swift programming. It systematically navigates a variety of important topics, from the principles of Access Control, Code Organization, and Testing to custom Operators, Subscripts, and Keypaths. It presents in-depth coverage of Swift’s powerful idioms, like Result Builders and Pattern Matching, and ensures your proficiency in handling real-world errors.

    The section further covers advanced concepts such as Encoding & Decoding Types, Memory Management, and takes you through the subtelties of value semantics. It presents a thorough discussion on Property Wrappers, the driving force behind popular frameworks like SwiftUI, and explores Protocol-Oriented Programming, underscoring Swift’s protocol-based design.

    Finally, it covers Advanced Protocols, Generics, and Concurrency, giving you a solid understanding of Swift’s language-level concurrency mechanisms. Each topic provides a robust foundation for advanced Swift programming, ensuring your grasp of these concepts is both thorough and practical.

    Swift gives you powerful tools for hiding complexity and organizing your code into easier-to-digest units. As your codebase grows,
    ensuring correctness with automated tests becomes more critical in your projects.

    You’ll learn how to define your own operators and use subscripts to make your types feel even more like built-in language constructs.
    Keypaths provide references to properties, and together with subscripts and dynamic member lookup, you can do amazing things.

    Swift is a concise, powerful language but can be verbose for certain tasks. Result builders allow you to create a domain-specific language and compactly express complex values. In this chapter, you will implement a result builder for making fancy attributed strings.

    With pattern matching, you can accomplish more with less typing, and it helps give Swift its modern language feel. This chapter picks up where “Swift Apprentice: Fundamentals – Chapter 4: Advanced Flow Control” left off and shows you powerful Swift idioms that let you work with switch statements, tuples, optionals and more.

    In the real world, you can’t avoid some errors. Gracefully handling errors is what sets mediocre code apart from great code. From handling missing values and simple initialization failure with optionals to providing greater diagnostic detail using full-featured error types, Swift provides language features to make your code robust and informative in the face of errors.

    Swift has a powerful system for saving and loading your types to and from, for example, a file system, over the internet or some other communication channel. Swift has exceptional out-of-the-box support for the JSON format you will become familiar with in this chapter.

    This chapter digs into the details of Swift’s automatic reference counting and memory management. It shows you how to avoid memory leaks when object relationships result in reference cycles.

    Value semantics have a clear advantage over reference semantics regarding local reasoning but can lead to inefficiency for large objects. This chapter shows you how to get the best of both worlds.

    Used widely in frameworks like Apple’s SwiftUI and Vapor, property wrappers are a general-purpose language feature for building reusable, custom logic that defines how a property behaves. This chapter highlights some pitfalls and develops an advanced example implementing the copy-on-write optimization.

    From the standard library to user-authored generics, Swift is a protocol-based language.
    In this chapter, you’ll see how to get all of the benefits associated
    with object-oriented programming while being able to avoid most of the difficulties.

    Learn how to use constraints to make generic code more useful
    and how to hide implementation details with type erasure and
    opaque return types.

    Swift concurrency is a new way to handle asynchronous and concurrent code. It implements structured concurrency and provides language features that check many aspects of your code at compile time. You’ll learn about these mechanisms and how actors protect the shared mutable state of your objects without needing a lot of error-prone, boilerplate code.



    Source link

  • Swift Apprentice: Fundamentals | Kodeco

    Swift Apprentice: Fundamentals | Kodeco


    This is a book for complete beginners to Apple’s modern programming language — Swift.

    All the code in the book works inside of Xcode’s easy-to-use playgrounds.
    That means you can focus on core Swift language concepts, such as classes, protocols,
    and generics, instead of getting bogged down in the details of building apps.

    This is a companion book to the SwiftUI Apprentice;
    the SwiftUI Apprentice focuses on building apps, while Swift Apprentice focuses
    on the Swift language itself.

    This is a book for complete beginners to Apple’s modern programming language — Swift.

    All the code in the book works inside of Xcode’s easy-to-use playgrounds. That means you can focus on core Swift language concepts, such as classes, protocols, and generics without getting bogged down by extraneous details.

    This…


    more

    This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book and more.

    The chapters in this section will introduce you to the very basics of programming in Swift. From the fundamentals of how computers work up to language structures, you’ll cover enough of the language to be able to work with data and organize your code’s behavior.

    The section begins with some groundwork to get you started.
    Once you have the basic data types in your head, it’ll be time to do things with that data, and finally, you’ll learn about an essential data type, optionals, that let you express potentially missing data.

    These fundamentals will get you Swiftly on your way, and before you know it, you’ll be ready for the more advanced topics that follow. Let’s get started!

    This is it, your whirlwind introduction to the world of programming! You’ll begin with an overview of computers and programming and then say hello to Swift playgrounds, where you’ll spend your coding time for the rest of this book.
    You’ll learn some basics, such as code comments, arithmetic operations, constants and variables. These are some of the fundamental building blocks of any language, and Swift is no different.

    You’ll learn about handling different types, including strings that allow you to represent text.
    You’ll learn about converting between types and get an introduction to type inference, which simplifies your life as a programmer.
    You’ll learn about tuple types which allow you to group values of any type together.

    You’ll learn how to make decisions and repeat tasks in your programs using syntax to control the flow.
    You’ll also learn about Booleans, which represent true and false values, and how you can use these to compare data.

    Continuing the theme of code not running in a straight line, you’ll learn about another loop known as the `for` loop. You’ll also learn about switch statements that are particularly powerful in Swift.

    Functions are the basic building blocks you use to structure your code in Swift. You’ll learn how to define functions to group your code into reusable units.

    This chapter covers optionals, a special type in Swift representing either a value or the absence of a value. By the end of this chapter, you’ll know why you need optionals and how to use them safely.

    So far, you’ve mostly seen data in the form of single elements. Although tuples can have multiple pieces of data, you have to specify the size upfront; a tuple with three strings is a completely different type from a tuple with two strings, and converting between them isn’t trivial. In this section, you’ll learn about collection types in Swift. Collections are flexible “containers” that let you store any number of values together.

    There are several collection types in Swift, but three important ones are arrays, dictionaries and sets. You’ll learn to apply custom operations and loop over collection types. Finally, you’ll revisit strings, which are collections of characters.

    All the collection types share similar interfaces but have very different use cases. As you read through these chapters, keep the differences in mind, and you’ll begin to develop a feel for which type you should use when.

    Arrays are the most common collection type you’ll run into in Swift that keep an ordered list of elements of the same type. On the other hand, Dictionaries let you look up elements efficiently using a key. Finally, Sets maintain an unordered collection of unique elements. You’ll learn all about these three types in this chapter.

    Once you have collections of items, you will want to perform operations with them.
    For example, sort them, filter them, add them up, etc. Swift gives you a powerful
    language construct, the closure, that lets you infinitely customize the behavior
    of such operations. In this chapter, you will learn about Swift’s most common
    collection algorithms and customize them with closures.

    Text processing is an essential application for any computer language, and String is Swift’s powerhouse type for text handling. Strings are bi-directional collections of Character types that balance correctness, performance and ease of use.

    Searching for patterns in text is a common task you’ll encounter in your programming travels. Swift provides a power type called Regex to perform that task. Using standard syntax, you can express complicated matching patterns to extract information from text. You can use an all-new regex builder syntax for improved compile-time support, which maximizes clarity and readability.

    You can create your own type by combining variables and functions into a new type definition. When you create a new type, you give it a name; thus, these custom types are known as named types. Structures are a powerful tool for modeling real-world concepts. You can encapsulate related concepts, properties and methods into a single, cohesive model.

    Swift includes four kinds of named types: structures, classes, enumerations and protocols. You’ll learn here how other named types use the concepts of methods and properties, how they differ, and where you want to use each.

    You’ll also learn about protocols & generics, which are types and methods that take as input other types instead of just methods, as well as custom types to build larger and complex things!

    The standard library has many useful types like Int, Double and String. However, it sadly does not include a Pizza type. Structures are types that can store named properties and define actions and behaviors. In this chapter, you will define your custom structure types and begin building a Pizza empire.

    In this chapter, you’ll learn about stored and computed properties, along with some tricks, such as how to monitor changes in a property’s value and delay the initialization of a stored property.

    Methods are merely functions that reside in a structure. You’ll look closely at how methods and initializers help you build full-featured, custom types.

    Structures let you define your own named types with custom properties and methods. In this chapter, you’ll get acquainted with classes, which are much like structures but have important differences that make them an invaluable addition to your toolbox.

    This chapter continues with class types describing how Swift supports the traditional concepts of inheritance and polymorphism. You will also learn about two-phase class initialization that you will need to build proper class hierarchies. This discussion will lay the foundation for using these concepts with Swift’s value types.

    In this chapter, you’ll learn about enumerations, a type that groups related, mutually exclusive case values. You’ll also learn about uninhabited types and finally discover what an optional is under the hood.

    Protocols are a type that can bridge common behaviors between structs,
    classes, and enums by defining an interface or template for an actual concrete type. Protocols enable polymorphism across all types and overcome the single inheritance limitation you saw with classes.

    In this chapter, you’ll learn what generics are, how to write generic code, and loop back and look at the generic types in Swift – dictionaries, arrays, and optionals – from this new perspective.



    Source link

  • Data Structures & Algorithms in Swift

    Data Structures & Algorithms in Swift


    Understanding how data structures and algorithms work in code is crucial for creating efficient and scalable apps and acing job interviews. Swift’s standard library and, more recently, the Swift Collections and Algorithms packages contain a robust set of general-purpose collection types and algorithms, yet they don’t cover every case!

    In Data Structures and Algorithms in Swift, you’ll learn how to implement the most popular and useful data structures and when and why you should use one particular data structure or algorithm over another. This set of basic data structures and algorithms will serve as an excellent foundation for building more complex and special-purpose constructs. The high-level expressiveness of Swift makes it an ideal choice for learning these core concepts without sacrificing performance.

    You’ll start with the fundamental structures of linked lists, queues and stacks, and see how to implement them in a highly Swift-like way. Move on to working with various types of trees, including general purpose trees, binary trees, AVL trees, binary search trees, and tries. Go beyond bubble and insertion sort with better-performing algorithms, including mergesort, radix sort, heap sort, and quicksort. Learn how to construct directed, non-directed and weighted graphs to represent many real-world models. Traverse those graphs and trees efficiently with breadth-first, depth-first, Dijkstra’s and Prim’s algorithms to solve problems such as finding the shortest path or lowest cost in a network.

    By the end of this book, you’ll have hands-on experience solving common issues with data structures and algorithms — and you’ll be well on your way to developing your own efficient and useful implementations!



    Source link