This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class ViewController: UIPageViewController { | |
class Inner: UIViewController { | |
var color: UIColor! | |
var name: String! | |
override func viewDidLoad() { | |
view.backgroundColor = color | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
class Foo: ObservableObject { | |
@Published var toggle = false | |
} | |
struct ContentView: View { | |
@EnvironmentObject var foo: Foo | |
var body: some View { | |
VStack { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/sagood/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/KocoClass/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/wujungao/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/asd8855/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/Yuanzc005/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/199305a/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/xuehaiwuya11/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/leoAntu/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/imthunder/awesome-iOS-resource/blob/master/Books/Swifter%20100个%20Swift%20必备%20Tips.pdf | |
https://github.com/Ericfengshi/awesome-iOS-resource/blob/master/Book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import WebKit | |
// Disableing `WKWebView` user zooming by returning `nil` in `UIScrollViewDelegate`'s | |
// `viewForZooming` delegate method. | |
// On iOS 12, the delegate method only called when set the web view itself as the | |
// scroll view delegate. | |
class WebView: WKWebView {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Solution goes in Sources | |
public struct Card: CustomStringConvertible { | |
enum Suit: String { | |
case spade = "♤", heart = "♡", club = "♧", diamond = "♢" | |
// It is not the standard Texas poker rule. All suits are considered equal. | |
// However, there is a test case to "brake tide by suit", in which "heart" is the largest. | |
var value: Int { | |
switch self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For Request and Response defination, see https://onevcat.com/2016/12/pop-cocoa-2/ | |
// Define the possible requests | |
protocol Request { | |
// Every request should have a corresponding Response | |
// Here we want all response could contain error cases | |
associatedtype Response: ErrorResponsable & Decodable | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
extension Notification { | |
struct UserInfoKey<ValueType>: Hashable { | |
let key: String | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
struct ToDoItem { | |
let id: UUID | |
let title: String | |
init(title: String) { | |
self.id = UUID() | |
self.title = title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol { | |
internal var _storage: _ContiguousArrayStorageBase | |
internal func _initStorageHeader(count: Int, capacity: Int) { | |
#if _runtime(_ObjC) | |
let verbatim = _isBridgedVerbatimToObjectiveC(Element.self) | |
#else | |
let verbatim = false | |
#endif |