mobile|移动端APP开发(5门语言 · 全套10阶案例)

iOS原生、安卓原生、Flutter跨端开发语言,界面、网络、推送、本地存储完整实战代码

域名 yiliancai.com | ICP备案:粤ICP备2026063737号 | 非商业个人学习站点

← 返回资料库总首页 | 集团主站 static.yiliancai.com

Swift iOS/Mac原生开发语言

简介:苹果官方开发语言,iPhone、iPad、Mac、Watch全平台应用开发

小白入门案例1:控制台Hello输出

let site = "doc.yiliancai.com" print("欢迎学习Swift iOS开发 | \(site)")

小白入门案例2:循环求和1~100

var sum = 0 for i in 1...100 { sum += i } print("总和:\(sum)")

基础实操案例3:用户结构体Model

struct User { let name: String let age: Int } let user = User(name: "罗秀萍", age: 28) print(user.name)

基础实操案例4:数组高阶过滤

let list = [User(name:"张三",age:22),User(name:"李四",age:26)] let adult = list.filter{$0.age > 24} print(adult.count)

进阶项目案例5:UIKit页面基础布局

import UIKit class MainVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() let label = UILabel(frame:CGRect(x:50,y:100,w:200,h:40)) label.text = "亿联财Swift教程" view.addSubview(label) } }

进阶项目案例6:Alamofire网络请求

import Alamofire func fetch(){ AF.request("https://static.yiliancai.com").responseString{ res in print(res.result.success?.count) } }

进阶项目案例7:SwiftUI声明式界面

import SwiftUI struct ContentView: View { var body: some View { VStack{ Text("SwiftUI学习") Button("查看教程"){} } } }

企业精通案例8:UserDefaults本地持久化

UserDefaults.standard.set("luoxiuping", forKey: "name") let name = UserDefaults.standard.string(forKey: "name") print(name!)

企业精通案例9:URLSession异步下载图片

func download(urlStr:String) async throws -> Data { guard let url = URL(string:urlStr) else {throw NSError(domain:"url错误",code:-1)} let (data,_) = try await URLSession.shared.data(from:url) return data }

企业精通案例10:APNs推送通知注册

import UserNotifications class PushMgr: NSObject, UNUserNotificationCenterDelegate { func requestAuth(){ let center = UNUserNotificationCenter.current() center.requestAuthorization(options:[.alert,.sound]){ grant,_ in if grant {UIApplication.shared.registerForRemoteNotifications()} } } }

剩余4门语言(Dart、Objective-C iOS、Kotlin Android、Flutter Dart)统一复用10阶移动端案例模板。