- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 517 Articles for Swift
![Ankita Saini](https://www.tutorialspoint.com/assets/profiles/489852/profile/60_2374666-1658225115.jpg)
272 Views
In this article, we will learn how to write a swift program to convert an array into a string and join elements with a specified character. An array is used to store elements of same data type in an order. Here we use the following methods to join elements of the array with a specified character − Using joined(separator:) function Without using inbuilt function Method 1: Using joined(separator:) Function So to convert an array into a string and join elements with a specified character we use joined(separator:) method. This method is used to concatenate the elements of the ... Read More
![Ankita Saini](https://www.tutorialspoint.com/assets/profiles/489852/profile/60_2374666-1658225115.jpg)
1K+ Views
To check if the given string is numeric or not we use Double() initializer in Swift Programming. A string is an ordered collection of characters for example “Sky”. A string can be numeric and non-numeric. A numeric string is a string which only contains numbers for example “12345”. So the valid numeric strings are: “3423”, “222333”, “34.342”, etc., whereas non-valid numeric strings are “23hfd23”, “423131sdd”, etc. So it converts the given string into double and return true if the given string is numeric otherwise return false. Algorithm Step 1 − Create a function Step 2 − Return ... Read More
![Ankita Saini](https://www.tutorialspoint.com/assets/profiles/489852/profile/60_2374666-1658225115.jpg)
209 Views
A matrix is an arrangement of numbers in rows and columns. A matrix has two diagonals i.e. Right diagonal and Left diagonal. So here we calculate the sum of the right diagonal of the square matrix using Swift Programming. For example, we have the following matrix − Matrix = 3 4 5 5 3 2 1 8 1 The right diagonal elements are 5, 3, 1. So the sum of right diagonal is 9(5+3+1). Algorithm Step 1 − ... Read More
![Ankita Saini](https://www.tutorialspoint.com/assets/profiles/489852/profile/60_2374666-1658225115.jpg)
119 Views
A matrix is an arrangement of numbers in rows and columns. Matrix can be of various type like square matrix, horizontal matrix, vertical matrix etc. So here we calculate the sum of the left diagonal of the square matrix using Swift Programming. A square matrix is a matrix in which the number of rows and columns are same. For example 2x2, 5x5, etc. For example, we have the following matrix − Matrix = 3 4 5 1 5 3 2 2 1 ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
4K+ Views
Understanding iOS memory management is essential for iOS and macOS development. The concept of weak self and unowned self is challenging to understand, especially for beginners. ARC (Automatic Reference Counting) may have solved many problems for us. Swift still requires that you manage references a lot of the time when you are not working with value types. ARC or Automatic Reference Counting Automatic Reference Counting (ARC) is used for tracking and managing the app’s memory usage. In most cases, this means that memory management “just works” in Swift, and you don’t need to think about memory management yourself. ARC automatically ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
1K+ Views
The "some" keyword in SwiftUI is used to indicate that a type conforms with a protocol, but the exact conformance is not specified. The AnyView type, a type-erased view that can represent any view conforming to the View protocol, is commonly used in association with it. SwiftUI defines some View as a type that, without identifying the specific view type, can represent any view that complies with the View protocol. This enables more generalized and adaptable code. In other words, some keyword is used to declare Opaque types. In the Swift 5.1 version, this is introduced with the support of ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
2K+ Views
In swift, we have three keywords - Open, Public, and Final keyword. All these three words have different properties that help us understand whether the code can be extended to another module or not making the code easy to reuse. We will learn about the keywords' properties in this article.Example Here's an example of how the open keyword is used in a class definition import Foundation open class Person { var firstName: String? var lastName: String? var age: Int? var address: String? } class Student: Person ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
131 Views
In this article, you will learn how and why to use a de-initializer in the Swift language. You will learn the concept of de-initializing using some examples. When a class instance is no longer required, Swift automatically calls a specific method called a deinitializer. It is utilized to carry out any necessary cleanup prior to deallocating an item from memory. The "deinit" keyword is used to create a deinitializer, which has no parameters or output.Syntax Here is the basic syntax of a de-initializer in Swift class ClassName { // Other properties and methods ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
13K+ Views
In swift, the completion handler is a block of code that is used to perform and handle the completion state of a task. For example, completion handlers are very commonly used in network requests using URLSession class. Basically, the completion handler is passed as a function argument and called when the task is completed. It does not impact whether the task is completed successfully or not. You can use the completion handler to perform different actions in your iOS applications. There are some common practices to implement the completion handler such as returning status after cleaning up the unused resources ... Read More
![Nitin Aggarwal](https://www.tutorialspoint.com/assets/profiles/558477/profile/60_3034393-1669108333.jpg)
422 Views
The init() method in Swift is used to initialize the objects of a class. When an object is created using the function Object() { [native code] } of the class, it is automatically called and establishes the object's initial state. To offer customized initialization behavior, such as establishing default values for properties or carrying out other setup chores, the init() method can be changed. Without returning any values, the function is sometimes used to initialize objects with some values. The class's designated initializer, the init() method, should be used to create objects of that class. Here is an example of ... Read More