Mario tsai




開一個project 例如: CoolUI



import CoolUI 後就可以使用裡面方法。

  1. Create framework

2. Add needed classes

3. Build Settings / Build Libraries for Distribution set YES

4. Build Settings / Skip Install set NO

5. Open termnial

6. cd and drag the folder with project

7. run three scripts in turn, which are located at the bottom (!) Don’t forget replace “PROJECTNAME_HERE” & “”FRAMEWORK_NAME” on your project name.

xcodebuild archive -scheme PROJECTNAME_HERE -destination=”iOS” -archivePath /tmp/xcf/ios.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphoneos SKIP_INSTALL=NO

xcodebuild archive -scheme PROJECTNAME_HERE -destination=”iOS Simulator” -archivePath /tmp/xcf/iossimulator.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphonesimulator SKIP_INSTALL=NO

xcodebuild -create-xcframework -framework /tmp/xcf/ios.xcarchive/Products/Library/Frameworks/PROJECTNAME_HERE.framework -framework /tmp/xcf/iossimulator.xcarchive/Products/Library/Frameworks/PROJECTNAME_HERE.framework -output FRAMEWORK_NAME.xcframework



under iOS13

class viewModel: {    var reloadCount: Int = 0    //ViewModel send to View   => react the event
var reloadCollectionView: ( ()->() )?

//View call ViewModel => user touch the Buttom (event)
func onTapCellButton() {
reloadCount += 1 self. reloadCollectionView?()



It’s a true story. It happens by accident.

class VC1 :UIViewController() {  let viewModel = VC1ViewModel()  func callVC2(){     let vc2 = UIViewController()     vc2.onTap = { (value) in         self.viewModel.callMom()  }  deinit(){
print("VC1 dead")

So, When VC1 dismiss or popup. VC2 and viewModel still in alive.

It prints nothing.





use Realm

let realm = try! Realm()

Make a Model

import Foundation

import RealmSwift

class LogData: Object{

@Persisted(primaryKey: true) var _id: ObjectId

@Persisted var date: String?

@Persisted dynamic var time: String?

convenience init(content: String){




func addNewLog(_ time:String,_ date:String) -> LogData{

let newLog = LogData()

newLog.time =…



增刪改檔案後記得下 composer dump-autoload

### 顯示路由
php artisan route:list

### new 一個controller
php artisan make:controller ProductController

//做一個ProductController 包 …



Big company has lots of ObjC code

Swfit -> ObjC


var name:String = Mario


/## ObjC

@interface ViewController ()

@property (nonatomic, strong) NSString* userName;


@implementation ViewController

NSLog(@”%@”, self.userName);




Mario tsai

Mario tsai

Major in physical education. Football referee. And high interest in looking the world through the numbers.