How to create Pascal’s Triangle in swift
[Link] In Pascal’s triangle, each element is the sum of the two numbers directly above it.
How to create Pascal’s Triangle in swift Read More »
[Link] In Pascal’s triangle, each element is the sum of the two numbers directly above it.
How to create Pascal’s Triangle in swift Read More »
Question: – if on given matrix any element is zero set entire row & column to zero [Link] Approach #2 Here we find the rows & cols which is zero & then iterate over matrix & make that rows and cols as zero
Set Matrix Zeroes in swift Read More »
A function which calls itself in the body & solve the problem is called recursion. we will take some example to understand #1 Print numbers from 1 to N Because Print is before recursion function it will print 1 to n #2 Print numbers from N to 1 #3 Sum of first N numbers #4
Recursion examples in swift Read More »
typealias also known as type-Identifier. so basically we are defining a substitute of a type. For example we can give type of String to Str as – typealias Str = String so now onwards you can use Str instead of String 1. Basic Example with data type You might thinking what’s the big thing in
How to use typealias in swift ? Read More »
iOS14 * if we want to scroll the List programmatically in iOS We can use scrollTo(.. function where we can pass the specific index for jump to the List. for example if we need to scroll to last of list we can use customArray.endIndex – 1likewise you can pass your desired index for example 4,5
How to programmatically scroll list SwiftUI ? Read More »
To check current device orientation in iOS application 1. NotificationCenter.default.publisher for detecting device orientation 2. .onReceive(… receive live values from the element on 3. getColor will return the color based on device orientation
How to detect device orientation in swiftUI ? Read More »
JSON stands for JavaScript Object Notation which is a standard text-based format for representing structured data based on JavaScript object syntax, we can use that in Swift, If you don’t have the JSON file you can create one Xcode->New->File->Stringslater you can rename .strings to .json & make sure it contains pure JSON only without any comments
How to read a JSON File Using Swift Read More »
Documentation helps developers & peers to get through the code explanation, we often use ⌥ Option + click to find inbuilt apple documentation or we can just jump towards inspector area & click on any method it will appear the markup description on right panel So Let’s start writing in our code example — Summary
How to use swift Documentation ? Read More »
In Swift we can use pow(::) for making power of any number. For Example if we need 2 power 3 – Further you can also typeCaste to Int as let output = Int(pow(a,b))// prints 8Remember to add import Foundation for get rid of compile time error.
How to get the Power of Integer in Swift Read More »
In general we use UIScrollView, UITableView or UICollectionView & sometimes we have to scroll programmatically to Top or bottom, so we can achieve it by using setContentOffset where we set where exactly to scroll Below are 4 helper methods which help in scrolling the Scroll view UIScrollView scroll to bottom UIScrollView scroll to Top UIScrollView
How To Scroll To A Position Programmatically In UIScrollView Read More »