Found 517 Articles for Swift

Swift Program to convert Decimal to Octal

Ankita Saini
Updated on 30-Nov-2022 06:07:46

287 Views

This tutorial will discuss how to write Swift program to convert Decimal to Octal. Decimal numbers are those numbers whose base value is 10. Decimal numbers are also known as base 10 number system which contain 10 numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Here, the position of every digit in the decimal number has weight is a power of 10. Octal numbers are those numbers whose base value is 8. Octal numbers are also known as base 8 number system which contain 8 numbers: 0, 1, 2, 3, 4, 5, 6, 7. Here, the position ... Read More

What is the meaning of the question mark "?" in Swift?

Nitin Aggarwal
Updated on 22-Nov-2022 11:15:11

2K+ Views

In this tutorial, you will learn what is a question mark in the Swift language, how to use it, and what it is used for. What does the question mark indicate? This question mark indicates that a variable might contain a nil value or some value of type declared with the variable. Before learning what a question mark is, let's understand what are optionals in Swift. Optionals When you create a variable in the Swift language, either it can contain an initial value or it might be holding nothing at the initial point. In that ... Read More

What Is Defer in Swift?

Nitin Aggarwal
Updated on 22-Nov-2022 11:11:52

4K+ Views

In this tutorial, you will learn what the defer keyword is and how it can be used in Swift. You will see in what situations you can use the defer keyword. What is defer? A defer is a statement that is used for executing code just before transferring program control outside of the scope that the statement appears. The defer statement is not something you will need to use often in Swift. It will be useful in situations when you want to clean resources before they go out of scope. The defer keyword was introduced in the ... Read More

What is a guard statement in Swift?

Nitin Aggarwal
Updated on 22-Nov-2022 11:08:23

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
Updated on 22-Nov-2022 10:55:28

881 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
Updated on 22-Nov-2022 10:42:43

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
Updated on 22-Nov-2022 10:37:53

829 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

Difference between Swift and Objective-C

Nitin Aggarwal
Updated on 22-Nov-2022 10:25:07

2K+ Views

In this tutorial, you are going to understand the difference between Swift and Objective-C languages. Both languages are used for Apple development but they are different from each other, let’s understand. How does Swift differ from Objective-C? Swift is overtaking Objective-C to become the most popular language for the Apple platform. Even Apple is updating Objective-C as well. Header Files The Objective-C language is based on C, but includes OOP concepts within it. In order to use the public functions and properties of any framework, we had to import header files. Swift does away ... Read More

Swift program to Print Numeric Hourglass Pattern

Ankita Saini
Updated on 03-Nov-2022 13:02:21

338 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
Updated on 03-Nov-2022 12:58:45

253 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

Advertisements