Swift Articles

Page 29 of 40

What is a guard statement in Swift?

Nitin Aggarwal
Nitin Aggarwal
Updated on 22-Nov-2022 3K+ Views

In this tutorial, you will learn about what is a guard statement and how it is implemented in the Swift language. Let's learn. What is a guard statement? In Swift, the guard is a statement that transfers control between codes like an if-else statement. The guard statement is the most commonly used statement in Swift. When certain conditions are not met to allow the flow to continue, the guard statement is used to transfer flow control. A guard statement is similar to an if statement with one major difference. The if statement runs when a certain condition ...

Read More

What are the collection types that are available in Swift?

Nitin Aggarwal
Nitin Aggarwal
Updated on 22-Nov-2022 1K+ Views

In this tutorial, you will learn about all the collections available in the Swift language, such as arrays, dictionaries, and sets. Collection Types Array Set Dictionary These collections are generic in Swift, which means they can store values of any type but of the same kind. They can work with strings, ints, classes, structs, booleans, etc. You can store any kind of value in them and cannot insert the wrong type of value by mistake. If you define a string array, you cannot insert values of Int or any other type. Points to ...

Read More

Lazy Stored Procedure in Swift

Nitin Aggarwal
Nitin Aggarwal
Updated on 22-Nov-2022 4K+ Views

In this tutorial, you are going to learn about the lazy stored procedure. What is the lazy keyword and how to use it in Swift? Let's learn. In iOS development, it is very common to deal with complex objects. But you need to use them until it’s really needed. In Swift, there are some declaration modifiers that modify the behavior of the declaration. An example of a lazy modifier is one that is used to modify the meaning of the stored variables of a class or structure. What Swift's stored properties are? In Swift, stored ...

Read More

Key features of the Swift programming language?

Nitin Aggarwal
Nitin Aggarwal
Updated on 22-Nov-2022 2K+ Views

In this tutorial, you are about to learn about what is Swift, and what are the key features of the Swift programming language. What is the Swift language? Swift is a clean and concise programming language that is growing fast and becoming increasingly popular. Swift was initially used for iOS development but has become very popular for many other things like macOS, watchOS, and server-side development. Basically, Apple introduced the Swift language as an open-source programming language as a replacement for Objective-C, C, and C++. The Swift language was created in 2014 and released publicly in 2015 ...

Read More

Swift program to Print Numeric Hourglass Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 586 Views

This tutorial will discuss how to write swift program to print numeric hourglass pattern. Numeric pattern is a sequence of numbers which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These numeric patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a numeric hourglass star pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Here we divide the numeric hourglass pattern in two portions upper half portion and ...

Read More

Swift program to Print Half Diamond Numeric Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 464 Views

This tutorial will discuss how to write swift program to print half diamond numeric pattern. Numeric pattern is a sequence of numbers which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These numeric patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a half diamond numeric pattern, we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Method 1 - Using Nested For Loop We can create a half diamond ...

Read More

Swift program to Print Sandglass Star Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 958 Views

This tutorial will discuss how to write swift program to print sandglass star pattern. Star pattern is a sequence of “*” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These star patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a sandglass star pattern, we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Here we divide the sandglass pattern in two portions upper half portion and lower half ...

Read More

Swift program to Print Diamond Star Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 929 Views

This tutorial will discuss how to write swift program to print diamond star pattern. Star pattern is a sequence of “*” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These star patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a diamond star pattern, we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Here we divide the diamond in two portions upper half pyramid and lower half pyramid ...

Read More

Swift program to Print Mirror Lower Star Triangle Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 330 Views

This tutorial will discuss how to write swift program to print mirror lower star triangle pattern. Star pattern is a sequence of “*” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These star patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a mirror lower star triangle pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our ...

Read More

Swift program to Print Upper Numeric Triangle Pattern

Ankita Saini
Ankita Saini
Updated on 03-Nov-2022 549 Views

This tutorial will discuss how to write swift program to print upper numeric triangle pattern. Numeric pattern is a sequence of numbers which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. These numeric patterns are generally used to understand or practice the program flow controls, also they are good for logical thinking. To create a upper numeric triangle pattern we can use any of the following methods − Using nested for loop Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = ...

Read More
Showing 281–290 of 397 articles
« Prev 1 27 28 29 30 31 40 Next »
Advertisements