git init
or
| :root { | |
| --ease-in-quad: cubic-bezier(.55, .085, .68, .53); | |
| --ease-in-cubic: cubic-bezier(.550, .055, .675, .19); | |
| --ease-in-quart: cubic-bezier(.895, .03, .685, .22); | |
| --ease-in-quint: cubic-bezier(.755, .05, .855, .06); | |
| --ease-in-expo: cubic-bezier(.95, .05, .795, .035); | |
| --ease-in-circ: cubic-bezier(.6, .04, .98, .335); | |
| --ease-out-quad: cubic-bezier(.25, .46, .45, .94); | |
| --ease-out-cubic: cubic-bezier(.215, .61, .355, 1); |
| import WebKit | |
| class NativeWebViewController: UIViewController { | |
| let viewportScriptString = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); meta.setAttribute('initial-scale', '1.0'); meta.setAttribute('maximum-scale', '1.0'); meta.setAttribute('minimum-scale', '1.0'); meta.setAttribute('user-scalable', 'no'); document.getElementsByTagName('head')[0].appendChild(meta);" | |
| let disableSelectionScriptString = "document.documentElement.style.webkitUserSelect='none';" | |
| let disableCalloutScriptString = "document.documentElement.style.webkitTouchCallout='none';" | |
| override func viewDidLoad() { | |
| // 1 - Make user scripts for injection |
| # The trick is to link the DeviceSupport folder from the beta to the stable version. | |
| # sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| # Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| # Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
| # (A similar approach works for older versions too, just change the version number after DeviceSupport) |
| import UIKit | |
| extension UICollectionReusableView { | |
| /// The default implementation of `defaultIdentifier()` uses `NSStringFromClass(class)` rather than `String(class)` so that the module name is includded. | |
| /// The hope being that this makes collisions unlikely making it unnnecessary to provide your own implementations. | |
| public class func defaultIdentifier() -> String { | |
| return NSStringFromClass(self) | |
| } | |
| } |
| let styles: [UIFont.TextStyle] = [ | |
| // iOS 17 | |
| .extraLargeTitle, .extraLargeTitle2, | |
| // iOS 11 | |
| .largeTitle, | |
| // iOS 9 | |
| .title1, .title2, .title3, .callout, | |
| // iOS 7 | |
| .headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
| ] |
| var el = document.createElement('script'); | |
| el.src = "https://raw.githubusercontent.com/lodash/lodash/3.10.1/lodash.min.js"; | |
| el.type = "text/javascript"; | |
| document.head.appendChild(el) |
| /* | |
| * This is an example provided by Facebook are for non-commercial testing and | |
| * evaluation purposes only. | |
| * | |
| * Facebook reserves all rights not expressly granted. | |
| * | |
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
| * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| // AFNetworking | |
| [[AFHTTPSessionManager manager] GET:@"http://httpbin.org/ip" parameters:nil success:^(NSURLSessionDataTask *task, id JSON) { | |
| NSLog(@"IP Address: %@", JSON[@"origin"]); | |
| } failure:^(NSURLSessionDataTask *task, NSError *error) { | |
| NSLog(@"Error: %@", error); | |
| }]; | |
| // NSURLSession | |
| NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/ip"]; |