Skip to content

melling/ios_topics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iOS Topics in Swift 5

Miscellaneous iOS 12 Swift 5.0 programs that implement minimal examples for various random topics.

I will blog about each examples as time permits under this section of my website: http://www.h4labs.com/dev/ios/swift_cookbook.html For now, I'll place notes in README.md files with each project.

Please note that I'm creating most of these application as "Single View Applications" then adding views (e.g. UITableView) in code. It's a personal preference to not use Storyboards.

Screenshot

NSLayoutConstraint.activate([
    centeredButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
    centeredButton.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0)
    ])

Screenshot

  • Buttons are equal size with 25 points between them
  • StackView is centered horizontally
  • StackView 10 points above bottom anchor
  • Add some extra padding to button width and height
// Add some extra button padding
rightBtn.contentEdgeInsets = UIEdgeInsets.init(top: 5, left: 5, bottom: 5, right: 5)

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

  • Subclass UITableViewController
  • Custom Header Height
  • Set Header Cell Color
  • Fixed Row Height: tableView.rowHeight = 80

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

  • CAShapeLayer() added to a UIViewController
  • Use UIBezierPath to draw shapes

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

Screenshot

func rotateIt() {
    UIView.animate(withDuration: 2,
        delay: 0,
        options: .curveEaseInOut,
        animations: {

            let transform = CGAffineTransform.identity.rotated(by: .pi)

            self.label.transform = CGAffineTransform(rotationAngle: .pi)

            self.aView.transform = transform
        }, completion: {_ in

            self.fadeIt()
        })
    }

Screenshot

Screenshot

Screenshot

func nextController(_ sender:UIButton) {
    let secondViewController = SecondViewController()

    self.navigationController?.pushViewController(secondViewController, animated: true)
}
func previousController(_ sender:UIButton) {

    _ = self.navigationController?.popViewController(animated: true)
}

Screenshot

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    self.window = UIWindow(frame: UIScreen.main.bounds)
    let navController = UINavigationController()
    self.window?.rootViewController = navController
    let topLevelController = ViewController()
    navController.addChildViewController(topLevelController)
    
    self.window?.makeKeyAndVisible()
    
    return true
}

Screenshot

Screenshot

 timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
  • Misc Notes

ImageMagick

  • Fix Mac OS installation error
convert ./screenshot.png -resize 25% screenshot-small.png; # Smaller screenshot
convert ./screenshot.png -resize 20% screenshot-toc.png; # Table of Contents screenshot

Ideas and In-Progress

Old

Screenshot