Category: iOS

iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company’s mobile devices, including the iPhone and iPod Touch; the term also included the versions running on iPads until the name iPadOS was introduced with version 13 in 2019. It is the world’s second-most widely installed mobile operating system, after Android. It is the basis for three other operating systems made by Apple: iPadOS, tvOS, and watchOS. It is proprietary software, although some parts of it are open source under the Apple Public Source License and other licenses.

  • Complete Login App in SwiftUI

    Complete Login App in SwiftUI

    This project follows the Swift MVVM design pattern. It also includes API examples and industry-standard project structure.

    It requires a Laravel project to run in the background. The Laravel project is very simple it requires only a few simple steps.

    Clone the Laravel project

    Download the source code

    Spread the love
  • SwiftUI combine rectangle and triangle in shape

    SwiftUI combine rectangle and triangle in shape

    SwiftUI combine rectangle and triangle in shape

    Making custom shape is not hard in SwiftUI by implementing func path(in rect: CGRect) -> Path. You just have to draw points in your desired location in 2D coordinate space by path.move() and path.addLine() func, a line will be drawn automatically.

    struct MomentumArrow: Shape {
        
        func path(in rect: CGRect) -> Path {
            var path = Path()
            
            let squareHeight = rect.height * 0.65
            
            // Rect
            path.move(to: CGPoint(x: 0, y: 0))
            path.addLine(to: CGPoint(x: 0, y: squareHeight))
            path.addLine(to: CGPoint(x: rect.width, y: squareHeight))
            path.addLine(to: CGPoint(x: rect.width, y: 0))
            path.addLine(to: CGPoint(x: 0, y: 0))
            
            // Triangle
            path.move(to: CGPoint(x: 0, y: squareHeight))
            path.addLine(to: CGPoint(x: rect.midX, y: rect.height))
            path.addLine(to: CGPoint(x: rect.width, y: squareHeight))
        
            return path
        }
        
    }
    Spread the love
  • Capture first frame of the video as an image on iOS and macOS in swift

    Capture first frame of the video as an image on iOS and macOS in swift

    import Foundation
    import Cocoa
    import AVKit
    import AVFoundation
    
    let asset: AVURLAsset = AVURLAsset.init(url: "URL OF ANY VIDEO local/remote")
    let imgGenerator: AVAssetImageGenerator = AVAssetImageGenerator.init(asset: asset)
    imgGenerator.appliesPreferredTrackTransform = true
                
    imgGenerator.generateCGImagesAsynchronously(forTimes: [NSValue(time: CMTime.zero)]) { (_, image, _, res, error) in
                    
                    if error == nil {
                        DispatchQueue.main.async {
                               let imageView = NSImage.init(cgImage: image!, size: NSSize.init(width: 180.0, height: 180.0));
                        }
                    } else {
                        DispatchQueue.main.async {
                            // Some other fallback image
                        }
                    }
    }
    
    Spread the love