Skip to content

Instantly share code, notes, and snippets.

View badalpub1991's full-sized avatar

Badal Shah badalpub1991

  • Surat,India
View GitHub Profile
//
// DebugPrint.swift
// Deep Links Test
//
// Created by Stewart Lynch on 2021-02-09.
//
import Foundation
enum DebugPrint {
@fuxingloh
fuxingloh / UICollectionView.swift
Last active February 23, 2023 08:38
iOS Swift: How to count the width of the UILabel. And how to size UICollectionViewCell dynamically with label.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let text = collections[indexPath.row].name
let width = UILabel.textWidth(font: titleFont, text: text)
return CGSize(width: width + left + right, height: height)
}
@ishaq
ishaq / AppDelegate.m
Last active September 6, 2018 10:04
iOS: load main interface programmatically
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIStoryboard *mainStoryboard = nil;
BOOL showLogin = NO;
if(showLogin == NO)
{
// mainStoryboard method looks like:
// return [UIStoryboard storyboardWithName:@"Main" bundle:nil];