Skip to content
JaneshSwift.com
JaneshSwift
  • Home
  • Swift
  • SwiftUI
  • DSA
    • Array-Strings
    • BinarySearch
    • String
    • Math
    • Sorting
    • StacksQueues
    • LinkedList
    • Recursion
    • DynamicProgramming
  • Android
  • About us
JaneshSwift.com
JaneshSwift

How to reverse String in swift?

Leave a Comment / Array-Strings, DSA

[Question]: Reverse a string with O(1) extra memory. The input string is given as an array of characters like [“C”, “A”, “R”] So here we have used one for loop which iterates half of array & swapping last with first

How to reverse String in swift? Read More »

How to create Pascal’s Triangle in swift

Leave a Comment / Array-Strings, DSA

[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 »

Set Matrix Zeroes in swift

Leave a Comment / Array-Strings, DSA

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 »

Recursion examples in swift

Leave a Comment / Recursion

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 »

How to use typealias in swift ?

Leave a Comment / iOS, Swift

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 »

How to programmatically scroll list SwiftUI ?

Leave a Comment / iOS, SwiftUI

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 »

How to detect device orientation in swiftUI ?

Leave a Comment / iOS, SwiftUI

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 »

How to read a JSON File Using Swift

Leave a Comment / iOS, SwiftUI

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 »

How to use swift Documentation ?

Leave a Comment / iOS, Swift, SwiftUI

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 »

How to get the Power of Integer in Swift

Leave a Comment / iOS, Swift, SwiftUI

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 »

Post pagination
← Previous 1 … 14 15 16 … 18 Next →
  • Home
  • Swift
  • SwiftUI
  • DSA
    • Array-Strings
    • BinarySearch
    • String
    • Math
    • Sorting
    • StacksQueues
    • LinkedList
    • Recursion
    • DynamicProgramming
  • Android
  • About us
Search
Search

Copyright © 2025 JaneshSwift | Powered by JaneshSwift

  • Privacy Policy
  • Terms & Conditions
  • About us
  • Contact us
  • Sitemap