Changes in Swift 4 Dictionary and Set

Dictionary and Set Collection type, Set and Dictionary are not so intuitive. Fortunately, the Swift team has improved both [SE-0165] Sequence Based Initialization First, the list can create a dictionary from a series of key value pairs (tuples): let nearestStarNames = ["Proxima Centauri", "Alpha Centauri A", "Alpha Centauri B", "Barnard's Star ...

Posted on Mon, 04 May 2020 02:19:10 -0700 by Tagette

Swift4 class and structure, document code.

Class and structure Official Apple documents Classes and Structures Apple official document translation Class and structure Comparison between class and structure Definition grammar class SomeClass { // class definition goes here } struct SomeStructure { // structure definition goes here } An actual code example is as ...

Posted on Fri, 03 Apr 2020 14:15:42 -0700 by quanghoc

Upload the image to the server with the latest Alamofire (swift 4.1) (with parameters) post method

Upload pictures to the server with the latest Alamofire (swift 4.1) (with parameters) 1. Prepare parameters let image = UIImage(named: "xxx") //The parameter after converting the picture to JPEG type data is compression ratio let jpegImage = UIImageJPEGRepresentation(image!, 0.5) //Parameters to be passed (such as the ...

Posted on Thu, 02 Apr 2020 00:14:55 -0700 by gooney0

Python object-oriented (class, inheritance of class)

Python Object Oriented Remember one sentence: Classes are templates, while instances are objects created from classes. Class is literally understood in the beginning of school. It can be unilaterally thought to be a kind. It is a sampling of similar characteristics, that is, something similar, which can abstract similar characteristics of tran ...

Posted on Thu, 26 Mar 2020 11:21:52 -0700 by redhair

ios learning note 02 optional type, making weather query app (network access)

lebus tutorial 02 p47 optional variable: Lectotype: Value, equal to xxx or no value nil, only variables declared as optional types can be assigned values Force to unpack! Optional binding: class FastCar:Car{ var window:Int? // Optional variable override func drive() { super.driv ...

Posted on Mon, 03 Feb 2020 05:30:13 -0800 by bal bal

php file operation (finally, encapsulate common file functions)

Document information related API $filename="./1-file.php"; //filetype($filename):Get the type of file,Returns the type of file echo 'The file type is:',filetype($filename),"\n";//file //filesize($filename): get the size of the file, return bytes echo 'The file size is:',filesize($filename),"\n";//1214 //filectime($filen ...

Posted on Sat, 11 Jan 2020 00:44:16 -0800 by FrostedFlakes

Send and receive messages through the nsnotification center in Objective-C?

I am trying to send and receive messages through the nsnotification center in Objective-C. However, I have not found any examples of how to do this. How do I send and receive messages through the nsnotification center? #1 building This helped me: // Add an observer that will respond to loginComplete [[NSNotificationCenter defaultCenter ...

Posted on Mon, 06 Jan 2020 08:47:02 -0800 by ozkan

swift custom pop up AlertView

swift custom pop up Custom AlertView If your swift project is under 4.0 pod 'AEAlertView', '1.0' Swift 4.0 and above direct pod This paper introduces the realization idea Source link Custom pop ups Look at the picture first. Project thinking Define a View to show Code block override init(frame: CGRect) { ...

Posted on Wed, 01 Jan 2020 04:16:41 -0800 by Ravenous

OC project ignore file configuration

Introduction - main problems to be solved oc projects often ignore files; For files that have been added to version control, let gitignore take effect; An explanation of citing others to ignore documents 1. Ignore file content in OC project # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, O ...

Posted on Sun, 22 Dec 2019 07:21:29 -0800 by ClanCC

Building process of IaaS platform

Basic configuration: controller: 1.Modify host name: hostnamectl set-hostname controller 2.Turn off the firewall and set power on not to start: systemctl stop firewalld systemctl disable firewalld 3.modify hosts Document: 192.168.214.10 controller 193.168.214.20 compute ...

Posted on Thu, 21 Nov 2019 10:53:35 -0800 by titeroy