This article is reprinted from the WeChat public account "AirPython", the author is Xing Anguo. Please contact the AirPython public account to reprint this article. 1. IntroductionHello everyone, I am Anguo! After writing a crawler in Python, sometimes we need to schedule the crawler in real time on the mobile phone, or display the crawler results in real time. In this scenario, we can write the crawler logic as an API and deploy it to the server, then write an App on the mobile terminal and directly call the interface through the interface element controls. In this article, we will talk about how to quickly write an iOS native App. 2. PreparationTo implement native iOS applications, we need to use Xcode on Mac to write and compile First, set up an Xcode developer account Open Xcode, select Xcode - Preferences - Accounts in the upper left corner, click the + sign in the lower left corner, and add a developer account Then, create a project using Xcode Select iOS App as the template, enter the project name, select "Swift" as the programming language, and click Next to complete the project creation. PS: Swift has a more concise syntax than OC Finally, specify the Sign signature for the newly created project If you have any questions about this part, you can click on the read original text at the end of the article to learn more. 3. Actual combatIn the actual combat part, we will explain it with a simple login page 3-1 Install dependent libraries Since the project is developed using Swift, it is recommended to use SPM (Swift Package Manager) to install dependencies. For example, the network request library "Alamofire" Project address: https://github.com/Alamofire/Alamofire Installation method: File - Swift Packages - Add Package Dependency - Enter the project address ( Github / Gitee ) - Select the installation version 3-2 Page Layout Open the "ContentView.swift" file in the project root directory and write the specific view under body First, use VStack to define a vertical layout box and define the child controls to be displayed horizontally in the center PS: The three common layout methods of SwiftUI are VStack, HStack, and ZStack, which represent vertical layout, horizontal layout, and depth layout respectively.
Then, the child elements add a local picture, two input boxes, a selection box, and a button in turn. in,
Finally, define variables and control data for two-way binding
3-3 Network request and result display Set a click event for the Button control, use Alamofire to make a network request, and finally write the result display to the result control and bind it to the data.
4. Final ThoughtsThis article describes the detailed steps of developing an iOS native application through a simple example; in actual applications, different functional modules can be customized and developed based on specific scenarios. |
<<: Create your own US App Store ID
>>: How to use iPad at work to improve work efficiency
After this upgrade, users can finally simply proc...
At the beginning of the 21st century, the deploym...
Marketing and promotion is an area of knowledge...
Mixed Knowledge Specially designed to cure confus...
The rocket upper stage is a device we often hear ...
It’s really hard to cover yourself with a quilt d...
Nowadays, the performance of mobile phones has soa...
To organize a good event, you cannot rely on sudd...
summary Since this autumn (September 1 to October...
What are invalid clicks? Invalid clicks are relat...
Netizen question: It is strawberry season recentl...
Recently, I saw some netizens discussing why liqu...
There is a very common phenomenon in the copywrit...
recently On the mountain road in Mount Tai scenic...