WWDC 2006 2007 2008 2009 2010 2011 2012 2013 2014
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
setupCollectionView() | |
} | |
func setupCollectionView() { | |
let searchCollectionView = UICollectionView(frame: .zero, collectionViewLayout: getCompositionalLayout()) |
import UIKit | |
public extension NSCollectionLayoutAnchor { | |
struct Offset { | |
fileprivate var absolute: CGPoint? | |
fileprivate var fractional: CGPoint? | |
private init(absolute: CGPoint?, fractional: CGPoint?) { | |
self.absolute = absolute | |
self.fractional = fractional |
import UIKit | |
import Combine | |
protocol DiffableListDataSourceType { | |
associatedtype SectionIdentifier: Hashable | |
associatedtype ItemIdentifier: Hashable | |
func apply(_ snapshot: NSDiffableDataSourceSnapshot<SectionIdentifier, ItemIdentifier>, | |
animatingDifferences: Bool, | |
completion: (() -> Void)?) |
import UIKit | |
extension UIView { | |
var allSubviews: [UIView] { | |
subviews + subviews.flatMap { $0.allSubviews } | |
} | |
func firstSubview<T: UIView>(of type: T.Type) -> T? { | |
allSubviews.first { $0 is T } as? T |
// | |
// PagerView.swift | |
// | |
// Created by Majid Jabrayilov on 12/5/19. | |
// Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
// | |
import SwiftUI | |
struct PagerView<Content: View>: View { | |
let pageCount: Int |
Most equations need to be solved numerically since no close-form expression representing their solutions can be obtained. For polynomial equations of order 1, 2, 3, 4 exact solutions can be obtained. I have created a series of solvers up to a cubic solver, that can be used to obtain most exact solutions. Of course with floating point errors, not everything is going to come out looking clean. To be able to handle complex numbers I made a simplified version of a complex number without all the mathematical operations.
If you call the cubicSolve
function with a = 0
then the solver falls back on the quadratic solver, the quadratic solver will fallback on the linear solver and linear solver will return an empty array(Thanks for catching that u\korbonix).
Example Usage
// | |
// AppDelegate.swift | |
// SwiftUITestApp | |
// | |
// Created by Matt Gallagher on 4/6/24. | |
// Copyright © 2019 Matt Gallagher. All rights reserved. | |
// | |
import Cocoa | |
import SwiftUI |
import Foundation | |
import UIKit | |
struct ViewStyle<T> { | |
let style: (T) -> Void | |
} | |
let filled = ViewStyle<UIButton> { | |
$0.setTitleColor(.white, for: .normal) | |
$0.backgroundColor = .red |
# Uncomment the next line to define a global platform for your project | |
# platform :ios, '9.0' | |
target '%TargetName%' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
# Pods for %TargetName% | |
# pod 'FBSDKCoreKit' | |
end |