├── .gitignore
├── README.md
├── Swift 5.9 C++互操作性
├── CPPCallSwift
│ ├── CPPCallSwift.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── CPPCallSwift
│ │ ├── CPPCallSwift-Bridging-Header.h
│ │ ├── Swift.swift
│ │ └── main.cpp
└── SwiftCallCPP
│ ├── SwiftCallCPP.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── SwiftCallCPP
│ ├── CPP.cpp
│ ├── CPP.hpp
│ ├── SwiftCallCPP-Bridging-Header.h
│ └── main.swift
├── YungFanPlaygroundBook
├── ConfigFiles
│ ├── Base
│ │ └── BaseBuildSettings.xcconfig
│ ├── BuildSettings.xcconfig
│ └── Overrides
│ │ └── BookOverridingBuildSettings.xcconfig
├── LICENSE
│ └── LICENSE.txt
├── LiveViewTestApp
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ └── LiveViewTestAppLaunchScreen.storyboard
│ ├── Info.plist
│ └── version.plist
├── PlaygroundBook.xcodeproj
│ ├── .xcodesamplecode.plist
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── PlaygroundBook
│ ├── Chapters
│ │ ├── Chapter1.playgroundchapter
│ │ │ ├── Manifest.plist
│ │ │ └── Pages
│ │ │ │ ├── One.playgroundpage
│ │ │ │ ├── Contents.swift
│ │ │ │ ├── LiveView.swift
│ │ │ │ └── Manifest.plist
│ │ │ │ └── Two.playgroundpage
│ │ │ │ ├── Contents.swift
│ │ │ │ ├── LiveView.swift
│ │ │ │ └── Manifest.plist
│ │ └── Chapter2.playgroundchapter
│ │ │ ├── Manifest.plist
│ │ │ └── Pages
│ │ │ └── PlaygroundPage.playgroundpage
│ │ │ ├── Contents.swift
│ │ │ ├── LiveView.swift
│ │ │ └── Manifest.plist
│ ├── Manifest.plist
│ ├── PrivateResources
│ │ └── Base.lproj
│ │ │ └── LiveView.storyboard
│ └── Sources
│ │ ├── LiveViewController.swift
│ │ ├── LiveViewSupport.swift
│ │ └── en.lproj
│ │ └── ManifestPlist.strings
├── README.md
└── SupportingContent
│ ├── OtherFrameworks
│ ├── iphoneos
│ │ └── LiveViewHost.framework
│ │ │ ├── Headers
│ │ │ ├── LVHHostViewController.h
│ │ │ ├── LVHInitialization.h
│ │ │ └── LiveViewHost.h
│ │ │ ├── Info.plist
│ │ │ ├── LiveViewHost
│ │ │ ├── Modules
│ │ │ ├── LiveViewHost.swiftmodule
│ │ │ │ ├── arm64.swiftdoc
│ │ │ │ └── arm64.swiftmodule
│ │ │ └── module.modulemap
│ │ │ ├── _CodeSignature
│ │ │ └── CodeResources
│ │ │ └── version.plist
│ └── iphonesimulator
│ │ └── LiveViewHost.framework
│ │ ├── Headers
│ │ ├── LVHHostViewController.h
│ │ ├── LVHInitialization.h
│ │ └── LiveViewHost.h
│ │ ├── Info.plist
│ │ ├── LiveViewHost
│ │ ├── Modules
│ │ ├── LiveViewHost.swiftmodule
│ │ │ ├── x86_64.swiftdoc
│ │ │ └── x86_64.swiftmodule
│ │ └── module.modulemap
│ │ ├── _CodeSignature
│ │ └── CodeResources
│ │ └── version.plist
│ ├── PlaygroundsFrameworks
│ ├── iphoneos
│ │ ├── PlaygroundBluetooth.framework
│ │ │ ├── Assets.car
│ │ │ ├── Headers
│ │ │ │ └── PlaygroundBluetooth.h
│ │ │ ├── Info.plist
│ │ │ ├── Modules
│ │ │ │ ├── PlaygroundBluetooth.swiftmodule
│ │ │ │ │ ├── arm64.swiftdoc
│ │ │ │ │ └── arm64.swiftmodule
│ │ │ │ └── module.modulemap
│ │ │ ├── PlaygroundBluetooth
│ │ │ ├── _CodeSignature
│ │ │ │ └── CodeResources
│ │ │ ├── en.lproj
│ │ │ │ └── Localizable.strings
│ │ │ └── version.plist
│ │ └── PlaygroundSupport.framework
│ │ │ ├── Headers
│ │ │ └── PlaygroundSupport.h
│ │ │ ├── Info.plist
│ │ │ ├── Modules
│ │ │ ├── PlaygroundSupport.swiftmodule
│ │ │ │ ├── arm64.swiftdoc
│ │ │ │ └── arm64.swiftmodule
│ │ │ └── module.modulemap
│ │ │ ├── PlaygroundSupport
│ │ │ ├── _CodeSignature
│ │ │ └── CodeResources
│ │ │ └── version.plist
│ └── iphonesimulator
│ │ ├── PlaygroundBluetooth.framework
│ │ ├── Assets.car
│ │ ├── Headers
│ │ │ └── PlaygroundBluetooth.h
│ │ ├── Info.plist
│ │ ├── Modules
│ │ │ ├── PlaygroundBluetooth.swiftmodule
│ │ │ │ ├── x86_64.swiftdoc
│ │ │ │ └── x86_64.swiftmodule
│ │ │ └── module.modulemap
│ │ ├── PlaygroundBluetooth
│ │ ├── _CodeSignature
│ │ │ └── CodeResources
│ │ ├── en.lproj
│ │ │ └── Localizable.strings
│ │ └── version.plist
│ │ └── PlaygroundSupport.framework
│ │ ├── Headers
│ │ └── PlaygroundSupport.h
│ │ ├── Info.plist
│ │ ├── Modules
│ │ ├── PlaygroundSupport.swiftmodule
│ │ │ ├── x86_64.swiftdoc
│ │ │ └── x86_64.swiftmodule
│ │ └── module.modulemap
│ │ ├── PlaygroundSupport
│ │ ├── _CodeSignature
│ │ └── CodeResources
│ │ └── version.plist
│ └── Tools
│ └── expandBuildSettingReferences
├── 命名空间与自定义View
├── 命名空间与自定义View.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ ├── student.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ ├── teacher.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ ├── student.xcuserdatad
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── 命名空间与自定义View.xcscheme
│ │ ├── teacher.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── 命名空间与自定义View.xcscheme
│ │ └── yangfan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── 命名空间与自定义View
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── CustomView.swift
│ ├── DynamicViewController.swift
│ ├── Info.plist
│ └── ViewController.swift
├── 基础语法
├── @objc修饰符
│ ├── @objc.playground
│ │ ├── Contents.swift
│ │ ├── contents.xcplayground
│ │ └── playground.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── @objc应用
│ │ ├── @objc应用.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ ├── stu1.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ └── xcschememanagement.plist
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── @objc应用
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── ViewController.swift
├── Data类型.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── IO.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── Never类型.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── Result类型.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── iOS-Swift访问权限
│ ├── iOS-Swift.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ ├── stu1.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ └── xcschememanagement.plist
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── iOS-Swift
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Person.swift
│ │ ├── SecViewController.swift
│ │ └── ViewController.swift
├── where关键字.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 元组.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 函数.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 协议.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 变量与常量.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 可选型.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 可选链.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 基本数据类型与运算符.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 字典.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 字符与字符串.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 实用知识.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 属性.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 异常处理.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 循环语句.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 扩展.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 数组.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 方法.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 日期与日历.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 条件语句.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 构造函数与析构函数.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 枚举.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 泛型.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 类.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 类型转换.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 结构体.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ └── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 闭包.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 闭包在集合中的使用.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── student.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ ├── teacher.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── 面向协议编程.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ ├── stu1.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── yangfan.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── 面向对象三大特性.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ ├── stu1.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ ├── student.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ ├── teacher.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ └── yangfan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── 混合开发
├── OCInvokeSwift
│ ├── OCInvokeSwift.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ ├── stu1.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ ├── student.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ ├── teacher.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ └── xcschememanagement.plist
│ │ │ ├── student.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ ├── OCInvokeSwift.xcscheme
│ │ │ │ └── xcschememanagement.plist
│ │ │ ├── teacher.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ ├── OCInvokeSwift.xcscheme
│ │ │ │ └── xcschememanagement.plist
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── OCInvokeSwift
│ │ ├── Calculator.swift
│ │ ├── OCInvokeSwift-Bridging-Header.h
│ │ └── main.m
├── Objective-C项目中调用Swift
│ ├── Objective-C项目中调用Swift.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ ├── Objective-C项目中调用Swift
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Objective-C项目中调用Swift-Bridging-Header.h
│ │ ├── Person.swift
│ │ ├── ViewController.h
│ │ ├── ViewController.m
│ │ └── main.m
│ ├── Objective-C项目中调用SwiftTests
│ │ ├── Info.plist
│ │ └── Objective_C_____SwiftTests.m
│ └── Objective-C项目中调用SwiftUITests
│ │ ├── Info.plist
│ │ └── Objective_C_____SwiftUITests.m
├── SwiftInvokeOC
│ ├── SwiftInvokeOC.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcuserdata
│ │ │ │ ├── stu1.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ ├── student.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ ├── teacher.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ │ └── yangfan.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcuserdata
│ │ │ ├── stu1.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ └── xcschememanagement.plist
│ │ │ ├── student.xcuserdatad
│ │ │ └── xcschemes
│ │ │ │ ├── SwiftInvokeOC.xcscheme
│ │ │ │ └── xcschememanagement.plist
│ │ │ ├── teacher.xcuserdatad
│ │ │ ├── xcdebugger
│ │ │ │ └── Breakpoints_v2.xcbkptlist
│ │ │ └── xcschemes
│ │ │ │ ├── SwiftInvokeOC.xcscheme
│ │ │ │ └── xcschememanagement.plist
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── SwiftInvokeOC
│ │ ├── Calculator.h
│ │ ├── Calculator.m
│ │ ├── header
│ │ └── SwiftInvokeOC-Bridging-Header.h
│ │ └── main.swift
└── Swift项目中调用Objective-C
│ ├── Swift项目中调用Objective-C.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── yangfan.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── yangfan.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
│ ├── Swift项目中调用Objective-C
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── Person.h
│ ├── Person.m
│ ├── Swift项目中调用Objective-C-Bridging-Header.h
│ └── ViewController.swift
│ ├── Swift项目中调用Objective-CTests
│ ├── Info.plist
│ └── Swift_____Objective_CTests.swift
│ └── Swift项目中调用Objective-CUITests
│ ├── Info.plist
│ └── Swift_____Objective_CUITests.swift
├── 版本新特性
└── Swift 5.1.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ └── yangfan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
└── 进阶知识
├── Codable协议.playground
├── Contents.swift
├── contents.xcplayground
└── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ ├── stu1.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ └── yangfan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── KeyPath.playground
├── Contents.swift
├── contents.xcplayground
└── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ ├── stu1.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ └── yangfan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── Playground可视化开发.playground
├── Contents.swift
├── contents.xcplayground
└── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ └── yangfan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
└── Reflection 和 Mirror.playground
├── Contents.swift
├── contents.xcplayground
└── playground.xcworkspace
├── contents.xcworkspacedata
├── xcshareddata
└── IDEWorkspaceChecks.plist
└── xcuserdata
└── yangfan.xcuserdatad
└── UserInterfaceState.xcuserstate
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .DS_Store
3 | Swift 5.9 C++互操作性/.DS_Store
4 | Swift 5.9 C++互操作性/CPPCallSwift/.DS_Store
5 | Swift 5.9 C++互操作性/SwiftCallCPP/.DS_Store
6 | YungFanPlaygroundBook/.DS_Store
7 | YungFanPlaygroundBook/PlaygroundBook/.DS_Store
8 | YungFanPlaygroundBook/PlaygroundBook/Chapters/.DS_Store
9 | YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/.DS_Store
10 | YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/.DS_Store
11 | 命名空间与自定义View/.DS_Store
12 | 基础语法/.DS_Store
13 | 基础语法/@objc修饰符/.DS_Store
14 | 混合开发/.DS_Store
15 | 混合开发/OCInvokeSwift/.DS_Store
16 | 进阶知识/.DS_Store
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Swift-learning
2 |
3 | ## [视频教程地址](https://ke.qq.com/course/423581)
4 |
5 | ## 主要内容
6 | 1. Swift 语法学习,兼容至 Swift 5
7 | 2. 编译环境:macOS 10.14.4 + Xcode 10.2
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | CPPCallSwift.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift/CPPCallSwift-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift/Swift.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Swift.swift
3 | // CPPCallSwift
4 | //
5 | // Created by 杨帆 on 2023/8/12.
6 | //
7 |
8 | import Foundation
9 |
10 | public func swiftFunc() {
11 | print("This is a swift func")
12 | }
13 |
14 | public class Person {
15 | public var name: String
16 | public var age: Int
17 |
18 | public init(name: String, age: Int) {
19 | self.name = name
20 | self.age = age
21 | }
22 |
23 | public func study() {
24 | print("好好学习")
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/CPPCallSwift/CPPCallSwift/main.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // main.cpp
3 | // CPPCallSwift
4 | //
5 | // Created by 杨帆 on 2023/8/12.
6 | //
7 |
8 | #include
9 | #include
10 | #include
11 | using namespace CPPCallSwift;
12 |
13 | int main(int argc, const char * argv[]) {
14 | // 直接访问Swift代码
15 | Person person = Person::init("zhangsan", 20);
16 | std::string name = person.getName();
17 | long age = person.getAge();
18 | std::cout << "Name: " << name << ", Age: " << age << std::endl;
19 | person.setName("lisi");
20 | person.setAge(21);
21 | name = person.getName();
22 | age = person.getAge();
23 | std::cout << "Name: " << name << ", Age: " << age << std::endl;
24 | person.study();
25 | swiftFunc();
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftCallCPP.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP/CPP.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // CPP.cpp
3 | // SwiftCallCPP
4 | //
5 | // Created by 杨帆 on 2023/8/12.
6 | //
7 |
8 | #include "CPP.hpp"
9 |
10 | Person createPerson(std::string name, int age) {
11 | Person person;
12 | person.name = name;
13 | person.age = age;
14 | return person;
15 | }
16 |
17 | std::vector allPerson() {
18 | std::vector people;
19 | Person person1 = createPerson("zhangsan", 20);
20 | Person person2 = createPerson("lisi", 21);
21 | Person person3 = createPerson("wangwu", 22);
22 | people.push_back(person1);
23 | people.push_back(person2);
24 | people.push_back(person3);
25 | return people;
26 | }
27 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP/CPP.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // CPP.hpp
3 | // SwiftCallCPP
4 | //
5 | // Created by 杨帆 on 2023/8/12.
6 | //
7 |
8 |
9 | #include
10 | #include
11 |
12 | struct Person {
13 | std::string name;
14 | int age;
15 | };
16 | std::vector allPerson();
17 |
18 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP/SwiftCallCPP-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import "CPP.hpp"
6 |
--------------------------------------------------------------------------------
/Swift 5.9 C++互操作性/SwiftCallCPP/SwiftCallCPP/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // SwiftCallCPP
4 | //
5 | // Created by 杨帆 on 2023/8/12.
6 | //
7 |
8 | import Foundation
9 |
10 | // 直接使用C++的类型
11 | let person = Person(name: "zhaoliu", age: 23)
12 | print(person.name, person.age)
13 | // 直接调用C++的函数
14 | for person in allPerson() {
15 | print(person.name, person.age)
16 | }
17 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/ConfigFiles/BuildSettings.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // See LICENSE folder for this template’s licensing information.
3 | //
4 | // Abstract:
5 | // A set of build settings which should be edited by the author of this project.
6 | // Other build settings which need to be modified should generally be set in the Project Editor.
7 | //
8 |
9 | // This is the prefix for all bundle identifiers in this project, including the playground book's ContentIdentifier by default.
10 | // This should be updated to something specific to your team.
11 | BUNDLE_IDENTIFIER_PREFIX = cn.edu.abc.yf
12 |
13 | // This is the base of the file name for the playground book produced by this project (e.g. "PlaygroundBook" in "PlaygroundBook.playgroundbook").
14 | PLAYGROUND_BOOK_FILE_NAME = YungFan的Swift教程
15 |
16 | // This is the ContentIdentifier of the playground book.
17 | // This should be updated to something specific to your team and your specific content.
18 | PLAYGROUND_BOOK_CONTENT_IDENTIFIER = $(BUNDLE_IDENTIFIER_PREFIX).$(PLAYGROUND_BOOK_FILE_NAME:rfc1034identifier)
19 |
20 | // This is the ContentVersion of the playground book.
21 | PLAYGROUND_BOOK_CONTENT_VERSION = 1.0
22 |
23 | // Additionally, include some base build settings which this project requires but which shouldn't generally be edited.
24 | // Do *not* remove this #include; if you do, the project will fail to build.
25 | #include "Base/BaseBuildSettings.xcconfig"
26 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/LICENSE/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright © 2019 Apple Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/LiveViewTestApp/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // See LICENSE folder for this template’s licensing information.
3 | //
4 | // Abstract:
5 | // Implements the application delegate for LiveViewTestApp with appropriate configuration points.
6 | //
7 |
8 | import UIKit
9 | import PlaygroundSupport
10 | import LiveViewHost
11 | import Book_Sources
12 |
13 | @UIApplicationMain
14 | class AppDelegate: LiveViewHost.AppDelegate {
15 | override func setUpLiveView() -> PlaygroundLiveViewable {
16 | // This method should return a fully-configured live view. This method must be implemented.
17 | //
18 | // The view or view controller returned from this method will be automatically be shown on screen,
19 | // as if it were a live view in Swift Playgrounds. You can control how the live view is shown by
20 | // changing the implementation of the `liveViewConfiguration` property below.
21 | return Book_Sources.instantiateLiveView()
22 | }
23 |
24 | override var liveViewConfiguration: LiveViewConfiguration {
25 | // Make this property return the configuration of the live view which you desire to test.
26 | //
27 | // Valid values are `.fullScreen`, which simulates when the user has expanded the live
28 | // view to fill the full screen in Swift Playgrounds, and `.sideBySide`, which simulates when
29 | // the live view is shown next to or above the source code editor in Swift Playgrounds.
30 | return .fullScreen
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/LiveViewTestApp/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/LiveViewTestApp/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/LiveViewTestApp/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 1
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/.xcodesamplecode.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Book_Sources.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 | LiveViewTestApp.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 2
16 |
17 | PlaygroundBook.xcscheme_^#shared#^_
18 |
19 | orderHint
20 | 1
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Name
6 | 第一章
7 | Pages
8 |
9 | One.playgroundpage
10 | Two.playgroundpage
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/One.playgroundpage/Contents.swift:
--------------------------------------------------------------------------------
1 | //#-hidden-code
2 | //
3 | // See LICENSE folder for this template’s licensing information.
4 | //
5 | // Abstract:
6 | // The Swift file containing the source code edited by the user of this playground book.
7 | //
8 | //#-end-hidden-code
9 |
10 | 编写代码:
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/One.playgroundpage/LiveView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // See LICENSE folder for this template’s licensing information.
3 | //
4 | // Abstract:
5 | // Instantiates a live view and passes it to the PlaygroundSupport framework.
6 | //
7 |
8 | import UIKit
9 | import PlaygroundSupport
10 |
11 | // Instantiate a new instance of the live view from the book's auxiliary sources and pass it to PlaygroundSupport.
12 | PlaygroundPage.current.liveView = instantiateLiveView()
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/One.playgroundpage/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Name
6 | 第一节
7 | LiveViewEdgeToEdge
8 |
9 | LiveViewMode
10 | VisibleByDefault
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Two.playgroundpage/Contents.swift:
--------------------------------------------------------------------------------
1 | //#-hidden-code
2 | //
3 | // See LICENSE folder for this template’s licensing information.
4 | //
5 | // Abstract:
6 | // The Swift file containing the source code edited by the user of this playground book.
7 | //
8 | //#-end-hidden-code
9 |
10 | 编写代码:
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Two.playgroundpage/LiveView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // See LICENSE folder for this template’s licensing information.
3 | //
4 | // Abstract:
5 | // Instantiates a live view and passes it to the PlaygroundSupport framework.
6 | //
7 |
8 | import UIKit
9 | import PlaygroundSupport
10 |
11 | // Instantiate a new instance of the live view from the book's auxiliary sources and pass it to PlaygroundSupport.
12 | PlaygroundPage.current.liveView = instantiateLiveView()
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/Two.playgroundpage/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Name
6 | 第二节
7 | LiveViewEdgeToEdge
8 |
9 | LiveViewMode
10 | VisibleByDefault
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter2.playgroundchapter/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Name
6 | 第二章
7 | Pages
8 |
9 | PlaygroundPage.playgroundpage
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter2.playgroundchapter/Pages/PlaygroundPage.playgroundpage/Contents.swift:
--------------------------------------------------------------------------------
1 | //#-hidden-code
2 | //
3 | // See LICENSE folder for this template’s licensing information.
4 | //
5 | // Abstract:
6 | // The Swift file containing the source code edited by the user of this playground book.
7 | //
8 | //#-end-hidden-code
9 |
10 | 编写代码:
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter2.playgroundchapter/Pages/PlaygroundPage.playgroundpage/LiveView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // See LICENSE folder for this template’s licensing information.
3 | //
4 | // Abstract:
5 | // Instantiates a live view and passes it to the PlaygroundSupport framework.
6 | //
7 |
8 | import UIKit
9 | import PlaygroundSupport
10 |
11 | // Instantiate a new instance of the live view from the book's auxiliary sources and pass it to PlaygroundSupport.
12 | PlaygroundPage.current.liveView = instantiateLiveView2()
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Chapters/Chapter2.playgroundchapter/Pages/PlaygroundPage.playgroundpage/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Name
6 | 第一节
7 | LiveViewEdgeToEdge
8 |
9 | LiveViewMode
10 | VisibleByDefault
11 |
12 |
13 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Manifest.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Version
6 | 4.0
7 | ContentIdentifier
8 | $(PLAYGROUND_BOOK_CONTENT_IDENTIFIER)
9 | ContentVersion
10 | $(PLAYGROUND_BOOK_CONTENT_VERSION)
11 | DevelopmentRegion
12 | $(DEVELOPMENT_LANGUAGE)
13 | DeploymentTarget
14 | $(PLAYGROUND_BOOK_DEPLOYMENT_TARGET_FOR_MANIFEST)
15 | SwiftVersion
16 | $(SWIFT_VERSION)
17 | Name
18 | PlaygroundBookName
19 | Chapters
20 |
21 | Chapter1.playgroundchapter
22 | Chapter2.playgroundchapter
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/PlaygroundBook/Sources/en.lproj/ManifestPlist.strings:
--------------------------------------------------------------------------------
1 | /*
2 | See LICENSE folder for this template’s licensing information.
3 |
4 | Abstract:
5 | Contains English localizations of values in Manifest.plist files in the playground book.
6 | */
7 |
8 | /* The localized name of the playground book. */
9 | "PlaygroundBookName" = "Swift教程";
10 | //
11 | ///* The localized name of the first chapter in the playground book. */
12 | //"ChapterOneName" = "第一章";
13 | //
14 | ///* The localized name of the first page in the first chapter in the playground book. */
15 | //"ChapterOnePageOneName" = "第一节";
16 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/README.md:
--------------------------------------------------------------------------------
1 | # 电子书开发步骤 #
2 |
3 | ## BuildSettings.xcconfig ##
4 |
5 | 首先需要在这里配置电子书的一些属性
6 | 1. `BUNDLE_IDENTIFIER_PREFIX `
7 | 2. `PLAYGROUND_BOOK_FILE_NAME`
8 | 3. `PLAYGROUND_BOOK_CONTENT_VERSION `
9 |
10 | ## PlaygroundBook下的Manifest.plist##
11 |
12 | 1. 配置电子书名字-`Name`(可引用Sources下的`ManifestPlist.strings`中的key)
13 | 2. 配置电子书章节-`Chapters`
14 |
15 | ## Source下的LiveViewSupport.swift ##
16 |
17 | 在这里编写方法初始化 `PrivateResources`下面的`LiewView.storyboard`,初始化的界面会成为电子书的内容的一部分(可理解为封面),不同的章节可以设置不同的内容,所以可能需要多个方法
18 | ## PrivateResources下的LiewView.storyboard ##
19 | 对应电子书一部分的界面,可以直接设计,但是由于不同章节的电子书可能需要不同的界面,所以需要多个ViewController,与`LiveViewSupport.swift `配合使用
20 | ## Chapter ##
21 |
22 | 1. 每一章对应一个`XXX.playgroundchapter`,可以直接复制进行多章节制作
23 | 2. 每个章节下的`Manifest.plist`可以指明章的名字和包含的Pages
24 | 3. `Pages`包含多个`XXX.playgroundpage`,每一个就是一节
25 | 4. 每个`playgroundpage`下有三个文件,下面会介绍
26 |
27 | ## Pages下的 playgroundpage##
28 | 1. `Contents.swift`:里面的内容会直接显示在电子书中,也是用户可以输入的地方,和`LiewView.storyboard`会合成一页完整的电子书
29 | 2. `LiveView.swift`:设置显示的内容(封面),这个里面会调用`LiveViewSupport.swift`里面的方法初始化界面
30 | 3. `Mainfest.plist`:配置节的内容
31 |
32 | ## 导入iPad ##
33 | 运行程序,找到 `Products`下面的`XXX.playgroundbook`文件,然后`Show in Finder`,通过隔空投送输出到iPad上,iPad会自动打开`Playgrounds`显示制作的电子书
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Headers/LVHHostViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LiveViewHostViewController.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | /// \brief A view controller which is capable of directly hosting a live view.
13 | ///
14 | /// \c LVHHostViewController should only be used directly if not using the default \c LiveViewHost.AppDelegate class.
15 | @interface LVHHostViewController : UIViewController
16 |
17 | @property (readwrite, nonatomic, nullable) UIViewController *liveView;
18 |
19 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Headers/LVHInitialization.h:
--------------------------------------------------------------------------------
1 | //
2 | // LVHInitialization.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /// \brief Initializes the LiveViewHost framework.
11 | ///
12 | /// This function is automatically called by \c LiveViewHost.AppDelegate.
13 | /// If you do not use \c LiveViewHost.AppDelegate, then you should call this function.
14 | FOUNDATION_EXPORT void LVHInitialize(void);
15 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Headers/LiveViewHost.h:
--------------------------------------------------------------------------------
1 | //
2 | // LiveViewHost.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | //! Project version number for LiveViewHost.
11 | FOUNDATION_EXPORT double LiveViewHostVersionNumber;
12 |
13 | //! Project version string for LiveViewHost.
14 | FOUNDATION_EXPORT const unsigned char LiveViewHostVersionString[];
15 |
16 | #import
17 | #import
18 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/LiveViewHost:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/LiveViewHost
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/arm64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/arm64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/arm64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/arm64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module LiveViewHost {
2 | umbrella header "LiveViewHost.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphoneos/LiveViewHost.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 49
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Headers/LVHHostViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LiveViewHostViewController.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | /// \brief A view controller which is capable of directly hosting a live view.
13 | ///
14 | /// \c LVHHostViewController should only be used directly if not using the default \c LiveViewHost.AppDelegate class.
15 | @interface LVHHostViewController : UIViewController
16 |
17 | @property (readwrite, nonatomic, nullable) UIViewController *liveView;
18 |
19 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Headers/LVHInitialization.h:
--------------------------------------------------------------------------------
1 | //
2 | // LVHInitialization.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /// \brief Initializes the LiveViewHost framework.
11 | ///
12 | /// This function is automatically called by \c LiveViewHost.AppDelegate.
13 | /// If you do not use \c LiveViewHost.AppDelegate, then you should call this function.
14 | FOUNDATION_EXPORT void LVHInitialize(void);
15 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Headers/LiveViewHost.h:
--------------------------------------------------------------------------------
1 | //
2 | // LiveViewHost.h
3 | // LiveViewHost
4 | //
5 | // Copyright © 2018 Apple Inc. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | //! Project version number for LiveViewHost.
11 | FOUNDATION_EXPORT double LiveViewHostVersionNumber;
12 |
13 | //! Project version string for LiveViewHost.
14 | FOUNDATION_EXPORT const unsigned char LiveViewHostVersionString[];
15 |
16 | #import
17 | #import
18 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/LiveViewHost:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/LiveViewHost
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/x86_64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/x86_64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/x86_64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Modules/LiveViewHost.swiftmodule/x86_64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module LiveViewHost {
2 | umbrella header "LiveViewHost.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/OtherFrameworks/iphonesimulator/LiveViewHost.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 49
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Assets.car:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Assets.car
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Headers/PlaygroundBluetooth.h:
--------------------------------------------------------------------------------
1 | //
2 | // PlaygroundBluetooth.h
3 | // PlaygroundBluetooth
4 | //
5 | // Copyright © 2017 Apple Inc. All rights reserved.
6 | //
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/arm64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/arm64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/arm64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/arm64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module PlaygroundBluetooth {
2 | umbrella header "PlaygroundBluetooth.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/PlaygroundBluetooth:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/PlaygroundBluetooth
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/en.lproj/Localizable.strings
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundBluetooth.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 1
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Headers/PlaygroundSupport.h:
--------------------------------------------------------------------------------
1 | //===--- PlaygroundSupport.h ----------------------------------------------===//
2 | //
3 | // This source file is part of the Swift.org open source project
4 | //
5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6 | // Licensed under Apache License v2.0 with Runtime Library Exception
7 | //
8 | // See http://swift.org/LICENSE.txt for license information
9 | // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10 | //
11 | //===----------------------------------------------------------------------===//
12 | //
13 | // This header is intentionally left blank.
14 | // It exists for the aid of code completion, which currently can only complete
15 | // Clang modules.
16 | //
17 | //===----------------------------------------------------------------------===//
18 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/arm64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/arm64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/arm64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/arm64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module PlaygroundSupport {
2 | umbrella header "PlaygroundSupport.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/PlaygroundSupport:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/PlaygroundSupport
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphoneos/PlaygroundSupport.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 49
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Assets.car:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Assets.car
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Headers/PlaygroundBluetooth.h:
--------------------------------------------------------------------------------
1 | //
2 | // PlaygroundBluetooth.h
3 | // PlaygroundBluetooth
4 | //
5 | // Copyright © 2017 Apple Inc. All rights reserved.
6 | //
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/x86_64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/x86_64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/x86_64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Modules/PlaygroundBluetooth.swiftmodule/x86_64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module PlaygroundBluetooth {
2 | umbrella header "PlaygroundBluetooth.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/PlaygroundBluetooth:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/PlaygroundBluetooth
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/en.lproj/Localizable.strings
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundBluetooth.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 1
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Headers/PlaygroundSupport.h:
--------------------------------------------------------------------------------
1 | //===--- PlaygroundSupport.h ----------------------------------------------===//
2 | //
3 | // This source file is part of the Swift.org open source project
4 | //
5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6 | // Licensed under Apache License v2.0 with Runtime Library Exception
7 | //
8 | // See http://swift.org/LICENSE.txt for license information
9 | // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10 | //
11 | //===----------------------------------------------------------------------===//
12 | //
13 | // This header is intentionally left blank.
14 | // It exists for the aid of code completion, which currently can only complete
15 | // Clang modules.
16 | //
17 | //===----------------------------------------------------------------------===//
18 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Info.plist
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/x86_64.swiftdoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/x86_64.swiftdoc
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/x86_64.swiftmodule:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Modules/PlaygroundSupport.swiftmodule/x86_64.swiftmodule
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module PlaygroundSupport {
2 | umbrella header "PlaygroundSupport.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/PlaygroundSupport:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/PlaygroundSupport
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/PlaygroundsFrameworks/iphonesimulator/PlaygroundSupport.framework/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildAliasOf
6 | SerenityBookTemplate
7 | BuildVersion
8 | 1
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 49
13 | ProjectName
14 | SerenityBookTemplate
15 | SourceVersion
16 | 14000000000000
17 |
18 |
19 |
--------------------------------------------------------------------------------
/YungFanPlaygroundBook/SupportingContent/Tools/expandBuildSettingReferences:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/YungFanPlaygroundBook/SupportingContent/Tools/expandBuildSettingReferences
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/命名空间与自定义View/命名空间与自定义View.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/xcuserdata/stu1.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | 命名空间与自定义View.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/xcuserdata/student.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | 命名空间与自定义View.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE3A7F4B1FB546F50062E360
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/xcuserdata/teacher.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/xcuserdata/teacher.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | 命名空间与自定义View.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE3A7F4B1FB546F50062E360
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | 命名空间与自定义View.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | 命名空间与自定义View.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View/CustomView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CustomView.swift
3 | // 命名空间与自定义View
4 | //
5 | // Created by teacher on 2017/11/10.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class CustomView: UIView {
12 |
13 | /*
14 | // Only override draw() if you perform custom drawing.
15 | // An empty implementation adversely affects performance during animation.
16 | override func draw(_ rect: CGRect) {
17 | // Drawing code
18 | }
19 | */
20 |
21 |
22 | //当用sb或者xib定义界面的时候会调用,如果是纯代码可以写一个fatalError,否则要去掉
23 | required init?(coder aDecoder: NSCoder) {
24 | fatalError("init(coder:) has not been implemented")
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View/DynamicViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DynamicViewController.swift
3 | // 命名空间与自定义View
4 | //
5 | // Created by teacher on 2017/11/10.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DynamicViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 |
16 | self.view.backgroundColor = UIColor.cyan
17 |
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/命名空间与自定义View/命名空间与自定义View/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | //1.协议的方法可选
5 | @objc protocol OptionalProtocol {
6 | @objc optional func optionalMethold1()
7 | @objc optional func optionalMethold2()
8 | }
9 |
10 | //2.iOS 开发
11 |
12 |
13 | //3.weak修饰协议
14 | //protocol MyDelegate : NSObjectProtocol{
15 | //
16 | // func method()
17 | //}
18 |
19 | @objc protocol MyDelegate{
20 |
21 | func method()
22 | }
23 |
24 | class MyClass{
25 |
26 | weak var delegate : MyDelegate?
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/@objc修饰符/@objc.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/xcuserdata/stu1.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | @objc应用.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | @objc应用.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/基础语法/@objc修饰符/@objc应用/@objc应用/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // @objc应用
4 | //
5 | // Created by stu1 on 2018/12/4.
6 | // Copyright © 2018年 abc. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 |
17 | let btn = UIButton(type: UIButton.ButtonType.contactAdd)
18 |
19 | btn.center = self.view.center
20 |
21 | btn.addTarget(self, action: #selector(click), for: UIControl.Event.touchUpInside)
22 |
23 | self.view .addSubview(btn)
24 | }
25 |
26 |
27 | @objc func click(btn:UIButton){
28 |
29 | print("按钮被点击了")
30 |
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/基础语法/Data类型.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | let originStr = "Hello Swift Data"
4 | //String转Data
5 | let data:Data = originStr.data(using: .utf8)!
6 | //Data转String
7 | let str = String(data: data, encoding: .utf8)
8 | print(str)
9 |
10 |
--------------------------------------------------------------------------------
/基础语法/Data类型.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/Data类型.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/Data类型.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/Data类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/Data类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/IO.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/IO.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/IO.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/IO.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/IO.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/IO.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/Never类型.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | func getInfo(from urlString: String, completionHandler: @escaping (Result) -> Void) {
5 |
6 | let data = "response result"
7 | completionHandler(.success(data))
8 |
9 | }
10 |
11 | //调用函数
12 | getInfo(from: "https://www.baidu.com") { result in
13 |
14 | switch result {
15 | case .success(let string):
16 | print(string)
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/基础语法/Never类型.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/Never类型.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/Never类型.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/Never类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/Never类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/Result类型.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/Result类型.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/Result类型.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/Result类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/Result类型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/xcuserdata/stu1.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | iOS-Swift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | iOS-Swift.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift/Person.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Person.swift
3 | // iOS-Swift
4 | //
5 | // Created by stu1 on 2018/11/27.
6 | // Copyright © 2018年 abc. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class Person: NSObject {
12 |
13 | private var age:Int = 10
14 |
15 | fileprivate var sex:String = "male"
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift/SecViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecViewController.swift
3 | // iOS-Swift
4 | //
5 | // Created by stu1 on 2018/11/27.
6 | // Copyright © 2018年 abc. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SecViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 |
16 | // Do any additional setup after loading the view.
17 | }
18 |
19 |
20 | /*
21 | // MARK: - Navigation
22 |
23 | // In a storyboard-based application, you will often want to do a little preparation before navigation
24 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
25 | // Get the new view controller using segue.destination.
26 | // Pass the selected object to the new view controller.
27 | }
28 | */
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/基础语法/iOS-Swift访问权限/iOS-Swift/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // iOS-Swift
4 | //
5 | // Created by stu1 on 2018/11/27.
6 | // Copyright © 2018年 abc. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 |
12 | class ViewController: UIViewController {
13 |
14 | fileprivate var data:String?
15 | private var dataArray:[String]?
16 |
17 | override func viewDidLoad() {
18 | super.viewDidLoad()
19 | // Do any additional setup after loading the view, typically from a nib.
20 |
21 | //由于Person是另外一个类中的 属性是私有修饰的 所以这边访问会出错
22 | let person = Person()
23 |
24 | }
25 |
26 |
27 | override func touchesBegan(_ touches: Set, with event: UIEvent?) {
28 |
29 | //同一个模块的文件可以直接访问 不像OC需要导入
30 | _ = SecViewController()
31 | }
32 | }
33 |
34 | extension ViewController {
35 |
36 | func test(){
37 | //扩展中可以访问本文件中的fileprivate和private
38 | self.data = "Hello"
39 | self.dataArray = ["World"]
40 | }
41 |
42 |
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/基础语法/where关键字.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //1.switch case
4 | let names = ["张三", "李四", "王五", "王小二"]
5 |
6 | for name in names {
7 |
8 | switch name {
9 | case let x where x.starts(with: "王"):
10 | print(x)
11 | default:
12 | print("这个人不姓王")
13 | }
14 |
15 | }
16 |
17 | names.filter { (name) -> Bool in
18 | name.starts(with: "王")
19 | }
20 |
21 |
22 | //2.for
23 | let nums = [0,1,2,3,4,5,6,7,8,9]
24 |
25 | for num in nums where num % 2 == 0{
26 |
27 | print(num)
28 | }
29 |
30 | nums.filter { (num) -> Bool in
31 |
32 | num % 2 == 0
33 | }
34 |
35 |
36 | //3.协议
37 | protocol Study{
38 |
39 | }
40 |
41 | extension Study where Self : UIView{
42 |
43 | func swift() {
44 | print("study swift")
45 | }
46 |
47 | }
48 |
49 | //struct Student:Study {
50 | //
51 | //
52 | //}
53 | //Student().swift()
54 |
55 | extension UIButton : Study{
56 |
57 | }
58 |
59 | UIButton().swift()
60 |
61 |
62 | //4.泛型
63 | func sum(num:T) where T : Study{
64 |
65 | print(num)
66 | }
67 |
68 | struct number : Study{}
69 |
70 | sum(num: number())
71 | //sum(num: 20.0)
72 |
73 |
74 | //5.异常处理
75 | enum HTTPError:Error{
76 |
77 | case HTTPCode(Int)
78 |
79 | }
80 |
81 | func throwsError() throws {
82 |
83 | throw HTTPError.HTTPCode(404)
84 | }
85 |
86 | do {
87 | try throwsError()
88 |
89 | } catch HTTPError.HTTPCode(let code) where code == 404 {
90 | print("资源找不到了")
91 | }
92 |
--------------------------------------------------------------------------------
/基础语法/where关键字.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/where关键字.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/where关键字.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/where关键字.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/where关键字.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/元组.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 |
6 | //[] {} ()
7 |
8 |
9 | //如果不写别名 默认以 .0 .1 ...的方式来访问元组中的数据
10 | var t:(String, String) = ("a", "b")
11 | //如果写了别名 就以别名的方式来访问元组中的数据
12 | var student = (id:"1001", name:"张三", english_score:30, chinese_score:90)
13 |
14 | print(student.id)
15 |
16 |
17 | //元组中的数据可以是类型不同的元素
18 | let (a, b, c) = (404, "Not Found", "HTTP STATUS")
19 | print(a)
20 | print(b)
21 | print(c)
22 |
23 | //运用
24 | let array = ["a", "b", "c", "d"]
25 |
26 | for (a, b) in array.enumerated(){
27 |
28 | print(a)
29 | print(b)
30 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/基础语法/元组.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/元组.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/元组.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/元组.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/元组.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/元组.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/函数.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/函数.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/函数.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/函数.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/函数.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/函数.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/协议.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/协议.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/协议.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/协议.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/协议.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/协议.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/协议.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 | // 变量与常量
5 | // print 与 \()
6 | // 分号问题
7 | // 注释
8 |
9 | var str: String = ""
10 |
11 | str = "Hello World"
12 | var 😍😍 = "两个脸"
13 |
14 |
15 | var age = 20
16 | var height = 1.8
17 | var weight = 70.4
18 |
19 | //printf("小明今年%d岁, 身高%f米,体重%f", age, height, weight);
20 | //NSLog("小明今年%d岁, 身高%f米,体重%f", age, height, weight);
21 |
22 | print("小明今年\(age)岁,身高\(height)米,体重\(weight)kg")
23 |
24 |
25 | let dog = "旺财"
26 | //常量不可以改变 所以会报错
27 | dog = "旺旺"
28 |
29 |
30 | var array1:[String] = []
31 | let array2:[String] = []
32 |
33 | /*
34 | NSArray
35 | NSMutableArray
36 | */
37 |
38 | ///NSDictionary
39 | ///NSMutableDictionary
40 |
41 |
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/变量与常量.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/变量与常量.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/变量与常量.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选型.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 | let name:String = "Hello"
6 | print(name)
7 |
8 | //let str = nil
9 |
10 | //1
11 | let str :Optional = nil
12 |
13 |
14 | //2
15 | var s : String? = nil
16 |
17 |
18 | //s = "Hi"
19 |
20 | //因为s已经是一个Optional的“包裹”的变量 如果想取出其中的值 就需要“解包” 解包需要用到!
21 | //if s != nil {
22 | // print(s!)
23 | //}
24 |
25 |
26 |
27 | // if let 常量名 = 可选型变量 ==> 当可选型有值的时候取出来打印,自动解包
28 | //if let 常量名=可选变量名 ... {
29 | // 语句
30 | //}
31 |
32 | if let r = s {
33 |
34 | print(r)
35 |
36 | }
37 |
38 |
39 |
40 | //隐式解析可选类型
41 | var a :String! = nil
42 |
43 | a = "Hello"
44 |
45 | print(a)
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/基础语法/可选型.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选链.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 |
6 | //这是Toy类
7 | class Toy{
8 |
9 | var price:Double = 100.0
10 |
11 | }
12 | /*这是Dog类*/
13 | class Dog{
14 |
15 | var color:UIColor = UIColor.red
16 | var toy :Toy?
17 |
18 | ///文档注释
19 | func run() {
20 |
21 | print("runing")
22 | }
23 |
24 | }
25 |
26 | // MARK:- 这是Person类
27 | class Person {
28 |
29 | var name:String = "zhangsan"
30 |
31 | var dog:Dog?
32 |
33 | }
34 |
35 |
36 | var toy = Toy()
37 | var dog = Dog()
38 | var person = Person()
39 |
40 | person.dog = dog
41 | dog.toy = toy
42 |
43 |
44 | let price = person.dog?.toy?.price
45 | print(price!)
46 |
47 |
48 |
--------------------------------------------------------------------------------
/基础语法/可选链.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/可选链.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/基本数据类型与运算符.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //基本类型
4 | var a: UInt = 10
5 | let maxValue = Int32.max
6 | let minValue = UInt8.min
7 | var b:Int = -1
8 |
9 | var c:Double = 1.5
10 |
11 | let d = Double(a) + Double(b) + c
12 |
13 | //Bool: true false
14 |
15 | var e = true
16 | e = false
17 |
18 | //if(1){}
19 | //
20 | //if(0){}else{}
21 |
22 | //元组
23 | let f = (1, "zhangsan", 20, "171000001", "移动应用开发", "male")
24 | let g = (id:1, name:"zhangsan", age:20, no:"171000001", zy:"移动应用开发", sex:"male")
25 | //下标的方式访问
26 | print(f.3)
27 | //别名的方式访问
28 | print(g.sex)
29 |
30 |
31 | var dic = ["id":"1", "name":"zhangsan"]
32 |
33 | for (key, value) in dic {
34 |
35 | print("\(key) -- \(value)")
36 | }
37 |
38 |
39 | //{"key1":"value1", "key2":"value2", ....}
40 | //
41 | //for(int i = 0; i
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/基本数据类型与运算符.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/字典.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/字典.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/字典.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/字典.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/字典.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/字典.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/字典.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/字符与字符串.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //字符
2 | var char:Character = "A"
3 | print(char)
4 |
5 | //字符串
6 | var str:String = "Hello World"
7 | print(str)
8 |
9 | var str2:String = String("ABC")
10 | print(str2)
11 |
12 | var shi:String = """
13 | 静夜思
14 | 唐代:李白
15 | 床前明月光,疑是地上霜。
16 | 举头望明月,低头思故乡。
17 | """
18 | print(shi)
19 |
20 | //字符串的用法
21 | //1.插值
22 | var age = 10
23 | print("小明今年\(age)岁")
24 |
25 |
26 | //2.遍历字符串
27 | for character in str {
28 | print(character)
29 | }
30 |
31 | //3.长度
32 | print(shi.count)
33 |
34 | //4.拼接
35 | var strO = "ABC"
36 | var strT = "School"
37 |
38 | print(strO + strT)
39 |
40 | //5.子串
41 |
42 | //"Hello World"
43 | //截取某字符串的前5个字符串
44 | let sub1 = str.prefix(5)
45 | //截取某字符串的后5个字符串
46 | let str1 = str.suffix(5)
47 |
48 |
49 | //也可以换种写法
50 | let index2 = str.index(str.endIndex, offsetBy: -5)
51 | let sub2 = str[index2..
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/字符与字符串.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/字符与字符串.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/字符与字符串.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/字符与字符串.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/字符与字符串.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/字符与字符串.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/实用知识.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | let number = 4
4 | // 检查一个整数是否为另一个整数的倍数
5 | if number.isMultiple(of: 2) {
6 | print("Even")
7 | } else {
8 | print("Odd")
9 | }
10 |
11 |
12 | //随机数生成
13 | let ranInt = Int.random(in: 0..<5)
14 | let ranFloat = Float.random(in: 0..<5)
15 | let ranDouble = Double.random(in: 0..<5)
16 | let ranBOOL = Bool.random()
17 |
18 | var names = ["ZhangSan", "LiSi", "WangWu"]
19 | // 对数组元素进行重新随机排序,重新返回一个数组
20 | let shuffled = names.shuffled()
21 |
22 |
23 | var array:[String] = ["Animal", "Baby", "Apple", "Google", "Aunt"]
24 | //随机取得数组中的一个元素
25 | let element = array.randomElement()
26 | print(element!)
27 |
28 |
29 | var isSwift = true
30 | //toggle函数没有返回值
31 | isSwift.toggle()
32 | print(isSwift)
33 |
--------------------------------------------------------------------------------
/基础语法/实用知识.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/实用知识.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/实用知识.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/实用知识.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/实用知识.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/属性.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/属性.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/属性.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/属性.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/属性.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/属性.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/属性.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 |
6 | // 1.定义异常
7 | enum FileReadError : Error {
8 | case FileISNull
9 | case FileNotFound
10 | }
11 |
12 | func readFileContent(filePath : String) throws -> String {
13 | // 1.filePath为""
14 | if filePath == "" {
15 |
16 | throw FileReadError.FileISNull
17 |
18 | }
19 |
20 | // 2.filepath有值,但是没有对应的文件
21 | if filePath != "/User/Desktop/123.plist" {
22 |
23 | throw FileReadError.FileNotFound
24 |
25 | }
26 |
27 | // 3.取出其中的内容
28 | return "123"
29 | }
30 |
31 |
32 | //do{
33 | // //如果try的过程中产生的异常
34 | // try 调用方法
35 | //
36 | // ...
37 | //}
38 | //catch{
39 | //
40 | // //一旦try出现了异常 直接跳转到catch里面来执行,默认有一个参数error来接收
41 | // print(error)
42 | //
43 | //}
44 | //defer {
45 | // //无论try是否出现异常 defer里面的代码都会执行
46 | //}
47 |
48 |
49 |
50 |
51 | do{
52 |
53 | try readFileContent(filePath: "123")
54 |
55 | }
56 |
57 | catch{
58 |
59 | //catch里面会自动捕获到错误的类型 默认有一个参数error来接收
60 | print(error)
61 |
62 | }
63 |
64 | defer {
65 | print("无论如何 我都会执行")
66 | }
67 |
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/异常处理.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/循环语句.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //C-style for statement has been removed in Swift 3
2 | //for(int i = 0; i< 10; i++){
3 | //
4 | //
5 | //}
6 |
7 |
8 | //i表示的是当前元素的索引
9 | for i in 0..<10 {
10 | print(i)
11 | }
12 |
13 | //当索引用不上的时候 可以用_
14 | for _ in 0...9 {
15 |
16 | print("Hello World")
17 |
18 | }
19 |
20 | for i in ["Hello","Hi","Welcome"] {
21 |
22 | print(i)
23 | }
24 |
25 | var a = 10
26 |
27 | while a == 10 {
28 |
29 | print("a == 10")
30 |
31 | a = a + 1
32 |
33 | }
34 |
35 |
36 | while true {
37 |
38 | a = a + 1
39 |
40 | print("break")
41 |
42 | if a == 15 {
43 |
44 | break;
45 | }
46 | }
47 |
48 |
49 | var b = 20
50 |
51 | repeat {
52 |
53 | print("b = \(b)")
54 |
55 | b = b + 1
56 |
57 | } while b == 20
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/基础语法/循环语句.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/循环语句.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/循环语句.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/循环语句.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/循环语句.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/扩展.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/扩展.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/扩展.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/扩展.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/扩展.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/扩展.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/扩展.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/数组.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | var str = "Hello, playground"
4 |
5 | //1.定义方式1
6 | var array1: [String] = [String]()
7 |
8 | array1.first
9 |
10 | var array2: [String] = Array()
11 |
12 | //2.定义方式2
13 | var array3:Array = [String]()
14 |
15 | var array4:Array = Array()
16 |
17 |
18 | //let 与 var
19 | let array5:[Int] = [1,2,3,4,5,6];
20 |
21 |
22 |
23 | //操作
24 | print(array5.count)
25 |
26 | print(array1.isEmpty)
27 |
28 | array3.append("A")
29 | array3.append("B")
30 | array3.append("C")
31 |
32 | array3.insert("D", at: 2)
33 |
34 | array3.removeLast()
35 |
36 | array3.first
37 |
38 | array3[0] = "AA"
39 |
40 | array3.reverse()
41 |
42 | print(array3)
43 |
44 | //遍历
45 | for i in 0..
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/数组.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/数组.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/数组.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/数组.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/数组.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/数组.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/方法.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | class Student {
4 | //存储属性
5 | var str = "Hello, playground"
6 | //实例方法
7 | func say(info:String) {
8 | print(info)
9 | }
10 | //实例方法
11 | func eat(food:String){
12 |
13 | //self关键字访问属性
14 | self.str = "Hello World"
15 | print(self.str)
16 | //self关键字调用方法
17 | self.say(info: food)
18 |
19 | print("吃\(food)")
20 | }
21 |
22 | //类型方法
23 | //可以用static或class修饰
24 | static func play(){
25 | print("play")
26 | }
27 | class func study(){
28 | print("study")
29 | }
30 |
31 | }
32 |
33 | var stu = Student()
34 | stu.eat(food: "红烧肉")
35 |
36 |
37 |
38 | struct Student2 {
39 |
40 | var str = "Hello, playground"
41 | func say(info:String) {
42 | print(info)
43 | }
44 | //结构体方法中修改属性 必须在前面加上 mutating
45 | mutating func eat(food:String){
46 | //self关键字访问属性
47 | self.str = "Hello World"
48 | //self关键字调用方法
49 | self.say(info: food)
50 | print("吃\(food)")
51 | }
52 |
53 | //结构体中只能用staitc
54 | static func play(){
55 | print("play")
56 | }
57 | }
58 |
59 |
60 |
--------------------------------------------------------------------------------
/基础语法/方法.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/方法.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/方法.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/方法.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/方法.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/方法.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/方法.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/日期与日历.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | let date = Date()
5 | let format = DateFormatter()
6 | format.dateFormat = "yyyy-MM-dd hh:mm:ss"
7 | let dateStr = format.string(from: date)
8 | print(dateStr)
9 |
10 |
11 | /**
12 | let date = Date()
13 | //创建一个DateComponents
14 | var components = DateComponents()
15 | //创建一个Calendar
16 | let calendar = Calendar.current
17 | //拆分
18 | calendar.component(.year, from: date)
19 | calendar.component(.month, from: date)
20 | calendar.component(.day, from: date)
21 | calendar.component(.hour, from: date)
22 | calendar.component(.minute, from: date)
23 | calendar.component(.second, from: date)
24 | calendar.component(.weekday, from: date)
25 | */
26 |
27 | /**
28 | //创建一个DateComponents
29 | var components = DateComponents()
30 | //设置各个时间成分
31 | components.year = 2019
32 | components.month = 8
33 | components.day = 1
34 | components.hour = 12
35 | components.minute = 0
36 | components.second = 0
37 | //创建一个Calendar
38 | let calendar = Calendar.current
39 | //转换
40 | var date = calendar.date(from: components)
41 | //输出转换结果
42 | print(date!)
43 | */
44 |
45 | /**
46 | let date = Date()
47 | //判断一个日期是否是今天
48 | let isToday = Calendar.current.isDateInToday(date)
49 | //判断一个日期是否是昨天
50 | let isYesterday = Calendar.current.isDateInToday(date)
51 | //判断一个日期是否是明天
52 | let isTomorrow = Calendar.current.isDateInTomorrow(date)
53 | //判断一个日期是否是属于周末双休日
54 | let isWeekend = Calendar.current.isDateInWeekend(date)
55 | //判断一个日期和另外一个是否相等
56 | let isSameDay = Calendar.current.isDate(date, inSameDayAs: Date())
57 | */
58 |
--------------------------------------------------------------------------------
/基础语法/日期与日历.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/日期与日历.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/日期与日历.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/日期与日历.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/日期与日历.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/条件语句.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/条件语句.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/条件语句.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/条件语句.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/条件语句.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/条件语句.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/条件语句.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/构造函数与析构函数.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/构造函数与析构函数.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/构造函数与析构函数.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/构造函数与析构函数.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/构造函数与析构函数.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/构造函数与析构函数.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/构造函数与析构函数.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/枚举.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 | //定义方式一
6 | enum Person {
7 |
8 | case Zhangsan
9 | case Lisi
10 | case Wangwu
11 |
12 | }
13 | //定义方式二
14 | enum Person2{
15 |
16 | case Zhangsan, Lisi, Wangwu
17 | }
18 |
19 | //赋值
20 | enum SiJi :Int {
21 |
22 | case Spring = 1
23 | case Summer = 2
24 | case Autumn = 3
25 | case Winter = 4
26 |
27 | }
28 |
29 | enum Method :Double {
30 |
31 | case Add = 1.0
32 | case Sub = 2.0
33 | case Mul = 3.0
34 | case Div = 4.0
35 |
36 | }
37 |
38 |
39 | enum Compass:String{
40 |
41 | case North = "A", South = "B", East = "C", West = "D"
42 |
43 | }
44 |
45 | var compass = Compass.North
46 |
47 | //rawValue 与 hashValue
48 | print(compass.rawValue)
49 | print(compass.hashValue)
50 |
51 |
52 | //此时查看a的类型 发现是一个可选型
53 | let a = SiJi(rawValue:2)
54 |
55 |
56 | if let p = a {
57 |
58 | switch p {
59 |
60 | //类型推断
61 | case .Spring:
62 | print("Spring")
63 | case .Summer:
64 | print("Summer")
65 | case .Autumn:
66 | print("Autumn")
67 | case .Winter:
68 | print("Winter")
69 |
70 | }
71 | }
72 |
73 |
74 | switch a! {
75 |
76 | case .Spring:
77 | print("Spring")
78 | case .Summer:
79 | print("Summer")
80 | case .Autumn:
81 | print("Autumn")
82 | case .Winter:
83 | print("Winter")
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/基础语法/枚举.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/枚举.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/枚举.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/枚举.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/泛型.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/泛型.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/泛型.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/泛型.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/泛型.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/泛型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/泛型.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //定义类
4 | class Person {
5 |
6 | var name = "Zhangsan"
7 | var age = 10
8 | var sex = "man"
9 |
10 | func say() {
11 |
12 | print("人会说话")
13 | }
14 |
15 | }
16 |
17 | //构造函数
18 | //默认构造函数
19 | var p1 = Person()
20 | p1.name
21 | p1.age = 30
22 | p1.age
23 | p1.sex
24 | p1.say()
25 |
26 |
27 | //引用类型
28 | //修改p2
29 | var p2 = p1
30 | p2.name = "Lisi"
31 | p2.age = 40
32 | p2.sex = "woman"
33 | //对p1有影响
34 | p1.name
35 | p1.age
36 | p1.sex
37 |
38 | //特征运算符
39 | let p3 = Person()
40 | p1 === p2
41 | p1 === p3
42 | p1 !== p3
43 |
44 |
45 |
46 | //继承
47 | // 定义一个父类
48 | class Vehicle {
49 | var currentSpeed = 0.0
50 | func makeNoise() {
51 | print("Ba Ba")
52 | }
53 | //不能被子类重写
54 | final func run() {
55 | print("Run Run")
56 | }
57 | }
58 |
59 | // 定义一个子类
60 | class Bicycle: Vehicle {
61 | var hasBasket = false
62 |
63 | override func makeNoise() {
64 | print("Ling Ling")
65 | }
66 |
67 | }
68 |
69 |
70 | var bicycle = Bicycle()
71 |
72 | bicycle.makeNoise()
73 |
74 | // 定义一个子类
75 | class Car: Vehicle {
76 | var banner = "皖B12345"
77 |
78 | override func makeNoise() {
79 | print("Di Di")
80 | }
81 | }
82 |
83 | var car = Car()
84 | car.makeNoise()
85 |
86 |
87 | //类型转换
88 | var vehicle = Vehicle()
89 | vehicle = bicycle as Vehicle
90 | vehicle.makeNoise()
91 |
--------------------------------------------------------------------------------
/基础语法/类.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/类.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/类.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/类.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 |
5 |
6 | // is
7 | let a:[Any] = ["a", "b", "c", 1]
8 |
9 | for b in a{
10 |
11 | print("----")
12 |
13 | //类型判断
14 | if b is Int {
15 |
16 | print("这是一个Int类型")
17 | }
18 |
19 |
20 | }
21 |
22 | // as
23 | class Animal {}
24 |
25 | class Cat: Animal {}
26 |
27 | let cat = Cat()
28 |
29 | //(1)从派生类转换为基类,向上转型
30 | let animal = cat as Animal
31 |
32 |
33 | //(2)数值类型转换
34 | let num1 = 42 as CGFloat
35 | let num2 = (42 / 2) as Double
36 |
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/类型转换.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/结构体.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //定义结构体
4 | struct Person {
5 |
6 | var name = "Zhangsan"
7 | var age = 10
8 | var sex = "man"
9 |
10 | func say() {
11 |
12 | print("人会说话")
13 | }
14 |
15 | }
16 |
17 | //构造函数
18 | //默认构造函数()
19 | var p1 = Person()
20 | p1.name
21 | p1.age
22 | p1.sex
23 | p1.say()
24 |
25 | //成员构造函数
26 | var p2 = Person(name: "Lisi", age: 20, sex: "woman")
27 |
28 | p2.name
29 | p2.age = 30
30 | p2.age
31 | p2.sex
32 | p2.say()
33 |
34 |
35 | //值类型
36 | var p3 = p2
37 |
38 | //对p3进行修改 并不会影响p2的值
39 | p3.age = 40
40 | p3.name = "Wangwu"
41 |
42 | p2.name
43 | p2.age
44 |
45 | p3.name
46 | p3.age
47 |
48 |
49 | //CGRect:矩形 iOS开发中用于描述控件的位置
50 | //CGSize:宽高 iOS开发中用于描述控件的大小
51 | //CGPoint:点(x,y) iOS开发中用于描述控件的起始位置(坐标)
52 |
--------------------------------------------------------------------------------
/基础语法/结构体.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/结构体.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/结构体.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/结构体.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/结构体.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/闭包.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/闭包.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/闭包.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/闭包在集合中的使用.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | //针对某个需要实现的功能,可以使用协议定义出接口,然后利用协议扩展提供默认的实现。需要这个功能,只需要声明遵守了这个协议即可,遵守某个协议的对象调用协议声明的方法时,如果遵循者本身没有提供实现,协议扩展提供的默认实现会被调用。
5 |
6 | //1.定义协议
7 | protocol Eatable{
8 |
9 | func eat()
10 |
11 | }
12 |
13 | //2.扩展协议
14 | extension Eatable {
15 |
16 | func eat() {
17 | print("吃饭了")
18 | }
19 | }
20 |
21 | //3.遵循协议
22 | class Person : Eatable {
23 |
24 | }
25 |
26 | //如果自己想要独特的功能 自己重写协议中的方法即可
27 | class Student : Eatable {
28 |
29 | func eat() {
30 | print("学生吃饭了")
31 | }
32 | }
33 |
34 | var p = Person()
35 | p.eat()
36 |
37 | var s = Student()
38 | s.eat()
39 |
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向协议编程.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向协议编程.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向协议编程.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/基础语法/面向对象三大特性.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/xcuserdata/stu1.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OCInvokeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/xcuserdata/student.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OCInvokeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE882D231FB035790027135A
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/xcuserdata/teacher.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OCInvokeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE882D231FB035790027135A
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OCInvokeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | OCInvokeSwift.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift/Calculator.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Calculator.swift
3 | // OCInvokeSwift
4 | //
5 | // Created by teacher on 2017/11/6.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | class Calculator: NSObject {
12 |
13 | @objc
14 | func add(num1:Int, num2:Int) -> Int {
15 |
16 | return num1 + num2;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift/OCInvokeSwift-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/混合开发/OCInvokeSwift/OCInvokeSwift/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OCInvokeSwift
4 | //
5 | // Created by teacher on 2017/11/6.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // 1、Swift类必须继承自NSObject 2、新建时创建的桥接文件和Swift调用OC的一样 3、导入的时候不是导入创建的头文件 而是一个命名为“项目名-Swift.h”的头文件 该头文件是自动生成的并且对开发者透明 4、在Swift代码中将需要暴露给OC调用的属性和方法前加上 @objc 5、直接在OC代码中调用Swift
12 | #import "OCInvokeSwift-Swift.h"
13 |
14 | int main(int argc, const char * argv[]) {
15 | @autoreleasepool {
16 |
17 | Calculator *cal = [[Calculator alloc]init];
18 |
19 | NSInteger result = [cal addWithNum1:20 num2:30];
20 |
21 | NSLog(@"%ld", (long)result);
22 |
23 |
24 |
25 | }
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Objective-C项目中调用Swift.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // Objective-C项目中调用Swift
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/Objective-C项目中调用Swift-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/Person.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Person.swift
3 | // Objective-C项目中调用Swift
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class Person: NSObject {
12 |
13 | //OC类能访问
14 | @objc var name:String?
15 | //OC类不能访问
16 | var age:Int?
17 | //OC类能访问
18 | @objc func eat(){
19 | print("\(name ?? "")吃饭了")
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // Objective-C项目中调用Swift
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // Objective-C项目中调用Swift
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import
11 |
12 | @interface ViewController ()
13 |
14 | @end
15 |
16 | @implementation ViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view.
21 |
22 | Person *person = [[Person alloc]init];
23 | person.name = @"YungFan";
24 | [person eat];
25 | }
26 |
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用Swift/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // Objective-C项目中调用Swift
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用SwiftTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用SwiftTests/Objective_C_____SwiftTests.m:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | #import
4 |
5 | @interface ___FILEBASENAMEASIDENTIFIER___ : XCTestCase
6 |
7 | @end
8 |
9 | @implementation ___FILEBASENAMEASIDENTIFIER___
10 |
11 | - (void)setUp {
12 | // Put setup code here. This method is called before the invocation of each test method in the class.
13 | }
14 |
15 | - (void)tearDown {
16 | // Put teardown code here. This method is called after the invocation of each test method in the class.
17 | }
18 |
19 | - (void)testExample {
20 | // This is an example of a functional test case.
21 | // Use XCTAssert and related functions to verify your tests produce the correct results.
22 | }
23 |
24 | - (void)testPerformanceExample {
25 | // This is an example of a performance test case.
26 | [self measureBlock:^{
27 | // Put the code you want to measure the time of here.
28 | }];
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用SwiftUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/Objective-C项目中调用Swift/Objective-C项目中调用SwiftUITests/Objective_C_____SwiftUITests.m:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | #import
4 |
5 | @interface ___FILEBASENAMEASIDENTIFIER___ : XCTestCase
6 |
7 | @end
8 |
9 | @implementation ___FILEBASENAMEASIDENTIFIER___
10 |
11 | - (void)setUp {
12 | // Put setup code here. This method is called before the invocation of each test method in the class.
13 |
14 | // In UI tests it is usually best to stop immediately when a failure occurs.
15 | self.continueAfterFailure = NO;
16 |
17 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
18 | [[[XCUIApplication alloc] init] launch];
19 |
20 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | }
26 |
27 | - (void)testExample {
28 | // Use recording to get started writing UI tests.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/student.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/teacher.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/xcuserdata/stu1.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftInvokeOC.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/xcuserdata/student.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftInvokeOC.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE0237CF1FAC09D600F69CC8
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/xcuserdata/teacher.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/xcuserdata/teacher.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftInvokeOC.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | AE0237CF1FAC09D600F69CC8
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftInvokeOC.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | SwiftInvokeOC.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC/Calculator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Calculator.h
3 | // SwiftInvokeOC
4 | //
5 | // Created by teacher on 2017/11/3.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | // 1、新建一个Swift项目 2、新建一个OC类,创建对应的属性和方法 3、在桥文件中 #import OC头文件 4、直接可以在Swift文件中使用OC里面定义的内容(可能反应有点慢)
8 |
9 |
10 | #import
11 |
12 | @interface Calculator : NSObject
13 |
14 | @property(nonatomic, assign)int number;
15 |
16 | -(int)add:(int)num1 AndNum:(int)num2;
17 |
18 | +(int)minus:(int)num1 AndNum:(int)num2;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC/Calculator.m:
--------------------------------------------------------------------------------
1 | //
2 | // Calculator.m
3 | // SwiftInvokeOC
4 | //
5 | // Created by teacher on 2017/11/3.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | //
8 |
9 | #import "Calculator.h"
10 |
11 | @implementation Calculator
12 |
13 | -(int)add:(int)num1 AndNum:(int)num2{
14 |
15 |
16 | return num1 + num2;
17 |
18 | }
19 |
20 | +(int)minus:(int)num1 AndNum:(int)num2{
21 |
22 |
23 | return num1 - num2;
24 |
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC/header/SwiftInvokeOC-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import "Calculator.h"
6 |
--------------------------------------------------------------------------------
/混合开发/SwiftInvokeOC/SwiftInvokeOC/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // SwiftInvokeOC
4 | //
5 | // Created by teacher on 2017/11/3.
6 | // Copyright © 2017年 teacher. All rights reserved.
7 | // 如果是自己新建的桥接文件,那么可能会因为找不到桥接文件而调用失败,需要在building setting 里搜索bridging 关键字,将后面的值改成实际桥接文件的路径。
8 |
9 | import Foundation
10 |
11 | var cal = Calculator()
12 |
13 | //调用实例fangfa
14 | var res = cal.add(23, andNum: 42)
15 |
16 | //调用类方法
17 | res = Calculator.minus(20, andNum: 10)
18 |
19 | //访问属性
20 | cal.number = 10
21 |
22 | print(res)
23 |
24 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C.xcodeproj/project.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C.xcodeproj/xcuserdata/yangfan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Swift项目中调用Objective-C.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C/Person.h:
--------------------------------------------------------------------------------
1 | //
2 | // Person.h
3 | // Swift项目中调用Objective-C
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface Person : NSObject
14 | @property (nonatomic, copy) NSString *name;
15 | -(void)eat;
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C/Person.m:
--------------------------------------------------------------------------------
1 | //
2 | // Person.m
3 | // Swift项目中调用Objective-C
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | #import "Person.h"
10 |
11 | @implementation Person
12 | -(void)eat{
13 | NSString *result = [NSString stringWithFormat:@"%@吃饭了", self.name];
14 | NSLog(@"%@", result);
15 | }
16 | @end
17 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C/Swift项目中调用Objective-C-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import "Person.h"
6 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-C/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // Swift项目中调用Objective-C
4 | //
5 | // Created by 杨帆 on 2019/7/18.
6 | // Copyright © 2019 杨帆. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view.
16 |
17 | //直接像实用Swift对象一样使用OC对象
18 | let person = Person()
19 | person.name = "YungFan"
20 | person.eat()
21 | }
22 |
23 |
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-CTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-CTests/Swift_____Objective_CTests.swift:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | import XCTest
4 | @testable import ___VARIABLE_productName:identifier___
5 |
6 | class ___FILEBASENAMEASIDENTIFIER___: XCTestCase {
7 |
8 | override func setUp() {
9 | // Put setup code here. This method is called before the invocation of each test method in the class.
10 | }
11 |
12 | override func tearDown() {
13 | // Put teardown code here. This method is called after the invocation of each test method in the class.
14 | }
15 |
16 | func testExample() {
17 | // This is an example of a functional test case.
18 | // Use XCTAssert and related functions to verify your tests produce the correct results.
19 | }
20 |
21 | func testPerformanceExample() {
22 | // This is an example of a performance test case.
23 | self.measure {
24 | // Put the code you want to measure the time of here.
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-CUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/混合开发/Swift项目中调用Objective-C/Swift项目中调用Objective-CUITests/Swift_____Objective_CUITests.swift:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | import XCTest
4 |
5 | class ___FILEBASENAMEASIDENTIFIER___: XCTestCase {
6 |
7 | override func setUp() {
8 | // Put setup code here. This method is called before the invocation of each test method in the class.
9 |
10 | // In UI tests it is usually best to stop immediately when a failure occurs.
11 | continueAfterFailure = false
12 |
13 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
14 | XCUIApplication().launch()
15 |
16 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | }
22 |
23 | func testExample() {
24 | // Use recording to get started writing UI tests.
25 | // Use XCTAssert and related functions to verify your tests produce the correct results.
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/版本新特性/Swift 5.1.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //函数、闭包单表达式函数的隐式返回
4 | func add(a:Int, b:Int) -> Int {
5 | a+b
6 | }
7 | add(a: 10, b: 20)
8 | struct Rectangle {
9 | var width = 0.0, height = 0.0
10 | var area: Double { width * height }
11 | }
12 |
13 |
14 | //根据默认值合成结构体的构造函数
15 | struct Person {
16 | var age = 0
17 | var name = "zhangsan"
18 | }
19 |
20 | let zhangsan = Person()
21 | let lisi = Person(age: 20, name: "lisi")
22 | let wangwu = Person(name: "wangwu")
23 |
24 | //不透明的返回类型
25 | func generateIntNumber() -> some Equatable {
26 | return 5
27 | }
28 |
29 | let number1 = generateIntNumber()
30 | let number2 = generateIntNumber()
31 |
32 | if number1 == number2 {
33 | print("numbers equal")
34 | }
35 |
36 | //属性包装类型
37 | @propertyWrapper
38 | struct Trimmed {
39 | private var value: String = ""
40 |
41 | // 计算属性
42 | var wrappedValue: String {
43 | get { value }
44 | set { value = newValue.trimmingCharacters(in: .whitespacesAndNewlines) }
45 | }
46 |
47 | init(initialValue: String) {
48 | self.wrappedValue = initialValue
49 | }
50 | }
51 |
52 |
53 | struct Post {
54 | //用上面定义的Trimmed修饰同类型的变量
55 | @Trimmed var title: String
56 | @Trimmed var body: String
57 | }
58 |
59 |
60 | //任何字符串无论是在初始化期间还是通过后面的属性访问都会自动删除前后面的空格。
61 | var post = Post(title: " Swift Property Wrappers ", body: " is very important ")
62 | post.title // "Swift Property Wrappers"
63 | post.body // "is very important"
64 |
65 | post.title = " @propertyWrapper "
66 | post.title // "@propertyWrapper"
67 |
--------------------------------------------------------------------------------
/版本新特性/Swift 5.1.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/版本新特性/Swift 5.1.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/版本新特性/Swift 5.1.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/版本新特性/Swift 5.1.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/版本新特性/Swift 5.1.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | //JSON
5 | let res = """
6 | {
7 | "name": "Jone",
8 | "age": 17,
9 | "born_in" : "China",
10 | "xingbie": "male"
11 | }
12 | """
13 |
14 | //定义结构体实现Codable,一般情况下字段要与JSON的key一致,否则需要额外处理
15 | struct Student: Codable {
16 | let name: String
17 | let age: Int
18 | let bornIn :String
19 | let sex: String
20 |
21 | //所有属性写全 会同时影响编码与解码
22 | enum CodingKeys :String, CodingKey {
23 | case name
24 | case age
25 | case bornIn = "born_in"
26 | case sex = "xingbie"
27 | }
28 | }
29 |
30 |
31 | //JSON -> 结构体/类 解码 decode
32 | let decoder = JSONDecoder()
33 |
34 | //如果用了CodingKeys,那么就不要用这个
35 | //驼峰命名转换
36 | //decoder.keyDecodingStrategy = .convertFromSnakeCase
37 |
38 | do {
39 |
40 | let stu:Student = try decoder.decode(Student.self, from: res.data(using: .utf8)!)
41 |
42 | print("name = \(stu.name) , age = \(stu.age) , boreIn = \(stu.bornIn) , sex = \(stu.sex)")
43 |
44 | } catch {
45 |
46 | print(error)
47 | }
48 |
49 |
50 | print("---------------------------")
51 |
52 | //结构体/类 -> JSON 编码 encode
53 |
54 | let student = Student(name: "zhangsan", age: 20, bornIn: "AnHui", sex:"female")
55 |
56 | let encoder = JSONEncoder()
57 |
58 | //驼峰命名转换
59 | //encoder.keyEncodingStrategy = .convertToSnakeCase
60 |
61 | encoder.outputFormatting = .prettyPrinted
62 |
63 | do {
64 |
65 | let data = try encoder.encode(student)
66 |
67 | print(String(data: data, encoding: .utf8)!)
68 |
69 |
70 | } catch {
71 |
72 | print(error)
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/Codable协议.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/Codable协议.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/Codable协议.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | //类必须继承NSObject
4 | class Student :NSObject {
5 | //那些属性可以通过KeyPath需要在前面加 @objc
6 | @objc var name: String
7 | @objc var age: Int
8 | @objc var born_in: String
9 | @objc var sex: String
10 |
11 | init(name:String, age:Int, born_in:String, sex:String) {
12 |
13 | self.name = name
14 | self.age = age
15 | self.born_in = born_in
16 | self.sex = sex
17 |
18 | }
19 | }
20 |
21 |
22 | let stu = Student(name: "zhangsan", age: 12, born_in: "2009-10-12", sex: "男")
23 | //正常获取值
24 | stu.age
25 | //Swift 3 之前
26 | stu.value(forKey: "name")
27 | //Swift 3
28 | stu.value(forKey:#keyPath(Student.born_in))
29 | //Swift 4
30 | stu[keyPath:\Student.sex]
31 |
32 | //设置值
33 | stu.age = 20
34 | //Swift 3 之前
35 | stu.setValue("lisi", forKey: "name")
36 | //Swift 3
37 | stu.setValue("2019-10-12", forKey:#keyPath(Student.born_in))
38 | //Swift 4
39 | stu[keyPath:\Student.sex] = "女"
40 |
41 | print(stu.age)
42 | print(stu.name)
43 | print(stu.born_in)
44 | print(stu.sex)
45 |
46 |
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/KeyPath.playground/playground.xcworkspace/xcuserdata/stu1.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/KeyPath.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/KeyPath.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/Playground可视化开发.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | //引入PlaygroundSupport
3 | import PlaygroundSupport
4 |
5 |
6 | //UIView
7 |
8 | //let label = UILabel(frame: CGRect(x: 0, y: 0, width: 400, height: 200))
9 | //label.backgroundColor = .white
10 | //label.font = UIFont.systemFont(ofSize: 32)
11 | //label.textAlignment = .center
12 | //label.text = "Hello World"
13 | //PlaygroundPage.current.liveView = label
14 |
15 | //let button = UIButton(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
16 | //button.setTitle("登陆", for: .normal)
17 | //button.setTitleColor(UIColor.red, for: .normal)
18 | //PlaygroundPage.current.liveView = button
19 |
20 | //UIViewController
21 | class ViewController: UITableViewController {
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 | view.backgroundColor = .cyan
25 | }
26 | }
27 |
28 | extension ViewController {
29 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
30 | return 30
31 | }
32 |
33 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
34 | let cell = UITableViewCell()
35 | cell.textLabel?.text = String(indexPath.row)
36 | return cell
37 | }
38 | }
39 |
40 | extension ViewController {
41 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
42 | print("Select: \(indexPath.row)")
43 | }
44 | }
45 |
46 | let vc = ViewController()
47 | //将显示的内容复制给PlaygroundPage.current.liveView
48 | PlaygroundPage.current.liveView = vc
49 |
--------------------------------------------------------------------------------
/进阶知识/Playground可视化开发.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/进阶知识/Playground可视化开发.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/进阶知识/Playground可视化开发.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/进阶知识/Playground可视化开发.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/Playground可视化开发.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/进阶知识/Reflection 和 Mirror.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | struct Person {
4 | let name: String
5 | let age: Int
6 |
7 | //方法不会被反射
8 | func eat() {
9 | print("chifan")
10 | }
11 | }
12 |
13 | let xiaoMing = Person(name: "XiaoMing", age: 16)
14 |
15 | //通过Mirror来进行反射
16 | let r = Mirror(reflecting: xiaoMing)
17 |
18 | //查看类型
19 | r.displayStyle!
20 |
21 | //属性的个数
22 | r.children.count
23 |
24 | //查看属性和属性的值
25 | for child in r.children {
26 | print(child.label!)
27 | print(child.value)
28 | }
29 |
30 | //使用 dump 方法来通过获取一个对象的镜像并进行标准输出的方式将其输出出来
31 | dump(xiaoMing)
32 |
--------------------------------------------------------------------------------
/进阶知识/Reflection 和 Mirror.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/进阶知识/Reflection 和 Mirror.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/进阶知识/Reflection 和 Mirror.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/进阶知识/Reflection 和 Mirror.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yungfan/Swift-learning/71227ed89679ba3355b48e3f8807ba870e9a708a/进阶知识/Reflection 和 Mirror.playground/playground.xcworkspace/xcuserdata/yangfan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------