Hopefully, after reading this, you will continue to have faith in yourself Swift

Swift internal work stop article: mp.weixin.qq.com/s/U95QmOOje…

If anyone can read it in one sitting, it’s a great achievement

The content of this article comes from Alamofire, GPUImage3 source code reading, found some strange knowledge points, even Swift guide has so much not familiar with the content. Fun note: Compared to Alamofire, the GPUImage3 author’s writing really sucks.

Protocol

  • ExpressibleByDictionaryLiteral
  • Sequence
  • Collection
  • CustomStringConvertible
  • Hashable Codable
  • Comparable
  • RangeReplaceableCollection

What are the common application scenarios and functions of the preceding protocols?

Second, @ propertyWrapper

Read the code below. What does print print

	@propertyWrapper
	struct Wrapper<T> {
    	var wrappedValue: T

    	var projectedValue: Wrapper<T> { return self }

    	func foo() { print("Foo") }
	}
	struct HasWrapper {
    	@Wrapper var x = 0
    
    	func foo() {
    	    print(x) // `wrappedValue`
    	    print(_x) // wrapper type itself
    	    print($x) // `projectedValue`
    	}
	}

Copy the code

Three, keywords

  • public open final
  • static class
  • mutating inout
  • infix operator
  • @dynamicMemberLookup
  • where
  • @dynamicCallable
  • @autoclosure
  • @escaping

What are the usage scenarios of the above keywords?

Higher order functions

  • Filter, Map, Reduce, flatmap, compactMap

What are the similarities and differences?

Five, the other

  • Currie,What do you mean
  • POP 与 OOPThe difference between
  • Any 与AnyObjectThe difference between
  • rethrows ε’Œ throwsWhat’s the difference?
  • break return continue fallthoughMeaning in statements (switch, while, for)

Six, think

  • What is the difference between the generic T and Any? How to use it?

Seven, use Swift to build a server?

🐻 Setting up the Swift server: Ubuntu16.04 + Vapor + Swift5.2.2 release

Finally, welcome to answer the gods!

The immortal answers are directly left in the comments section, I will update the answers later after sorting out!

Add V note: nuggets; Get into groups and learn together 🐻