ရိုးရိုးလေး ရှင်းပြမယ်
What is Swift? ကို ရိုးရိုးလေးနားလည်မယ်
Swift သည် Apple ecosystem အတွက် အဓိကအသုံးများတဲ့ modern programming language ဖြစ်ပါတယ်။ iPhone app, iPad app, Mac app, Apple Watch app, Apple TV app တွေတည်ဆောက်ရာမှာ Swift ကိုအများကြီးအသုံးပြုကြပါတယ်။ Server-side Swift နဲ့ Linux ပေါ်မှာလည်း အသုံးပြုနိုင်ပါတယ်။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
print(Hello) လို့ quote မထည့်ဘဲရေးရင် Swift က Hello ကို variable name လို့ယူဆပြီး error ပြနိုင်ပါတယ်။
ဖြစ်လေ့ရှိတဲ့အမှား
Sample output တစ်ခုမှန်ရုံဖြင့်nil, ownership, actor isolation နဲ့error paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
What is Swift? ကိုSwift 6.2 type safety, definite initialization, Unicode, protocol-oriented design နဲ့strict concurrency ဆက်နွယ်မှုနဲ့နားလည်ပါ။ Compiler diagnostics ကိုdesign feedback အဖြစ်ယူပြီးclear intent နဲ့tests ကိုဦးစားပေးပါ။
- Typed value
- Swift expression / function
- Safe result
What is Swift? ရဲ့type, ownership နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
// Swift code ကို Playground ထဲမှာ တိုက်ရိုက် run ကြည့်နိုင်ပါတယ်။
print("Hello, Swift!")What is Swift? ကိုSwift 6.2 type safety, definite initialization, Unicode, protocol-oriented design နဲ့strict concurrency ဆက်နွယ်မှုနဲ့နားလည်ပါ။ Compiler diagnostics ကိုdesign feedback အဖြစ်ယူပြီးclear intent နဲ့tests ကိုဦးစားပေးပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Typed value
// Swift code ကို Playground ထဲမှာ တိုက်ရိုက် run ကြည...Swift သည် Apple ecosystem အတွက် အဓိကအသုံးများတဲ့ modern programming language ဖြစ်ပါတယ်။ iPhone app, iPad app, Mac app, Apple Watch app, Apple TV app တွေတည်ဆောက်ရာမှာ Swift ကိုအများကြီးအသုံးပြုကြပါတယ်။ Server-side Swift နဲ့ Linux ပေါ်မှာလည်း အသုံးပြုနိုင်ပါတယ်။
- Swift expression / function
print("Hello, Swift!")What is Swift? ကိုSwift 6.2 type safety, definite initialization, Unicode, protocol-oriented design နဲ့strict concurrency ဆက်နွယ်မှုနဲ့နားလည်ပါ။ Compiler diagnostics ကိုdesign feedback အဖြစ်ယူပြီးclear intent နဲ့tests ကိုဦးစားပေးပါ။
- Safe result
print("Hello, Swift!")What is Swift? example ကိုempty, nil, boundary, invalid, error နဲ့cancellation cases ဖြင့်run/test လုပ်ပါ။ Value copy, shared reference, actor isolation နဲ့main-actor effects ကိုလိုအပ်သလိုစစ်ပါ။
- Typed value
- Swift expression / function
- Safe result
Success
What is Swift? ရဲ့type, ownership နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
Failure
print(Hello) လို့ quote မထည့်ဘဲရေးရင် Swift က Hello ကို variable name လို့ယူဆပြီး error ပြနိုင်ပါတယ်။
Swift သည် Apple ecosystem အတွက် အဓိကအသုံးများတဲ့ modern programming language ဖြစ်ပါတယ်။ iPhone app, iPad app, Mac app, Apple Watch app, Apple TV app တွေတည်ဆောက်ရာမှာ Swift ကိုအများကြီးအသုံးပြုကြပါတယ်။ Server-side Swift နဲ့ Linux ပေါ်မှာလည်း အသုံးပြုနိုင်ပါတယ်။
Swift ရဲ့ အားသာချက်က code ဖတ်ရလွယ်ခြင်း၊ error ဖြစ်နိုင်တဲ့နေရာတွေကို compile time မှာစောစောသတိပေးခြင်း၊ performance ကောင်းခြင်း၊ modern app development pattern တွေနဲ့ လိုက်ဖက်ခြင်းတို့ပါ။
// Swift code ကို Playground ထဲမှာ တိုက်ရိုက် run ကြည့်နိုင်ပါတယ်။
print("Hello, Swift!")print() က console ထဲကို text ထုတ်ပြတဲ့ function ဖြစ်ပါတယ်။ Swift မှာ simple script လိုမျိုး file ထိပ်ဆုံးကနေ code ရေးပြီး run လို့ရတဲ့အတွက် စတင်လေ့လာတဲ့အချိန်မှာ အဆင်ပြေပါတယ်။
Hello, Swift!Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
What is Swift? example ကိုempty, nil, boundary, invalid, error နဲ့cancellation cases ဖြင့်run/test လုပ်ပါ။ Value copy, shared reference, actor isolation နဲ့main-actor effects ကိုလိုအပ်သလိုစစ်ပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
What is Swift? example ကိုempty, nil, boundary, invalid, error နဲ့cancellation cases ဖြင့်run/test လုပ်ပါ။ Value copy, shared reference, actor isolation နဲ့main-actor effects ကိုလိုအပ်သလိုစစ်ပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
// Swift code ကို Playground ထဲမှာ တိုက်ရိုက် run ကြည့်နိုင်ပါတယ်။
print("Hello, Swift!")ရလဒ်: What is Swift? ရဲ့type, ownership နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
What is Swift? example ကိုempty, nil, boundary, invalid, error နဲ့cancellation cases ဖြင့်run/test လုပ်ပါ။ Value copy, shared reference, actor isolation နဲ့main-actor effects ကိုလိုအပ်သလိုစစ်ပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Typed value → Swift expression / function → Safe result
- What is Swift? ကိုSwift 6.2 type safety, definite initialization, Unicode, protocol-oriented design နဲ့strict concurrency ဆက်နွယ်မှုနဲ့နားလည်ပါ။ Compiler diagnostics ကိုdesign feedback အဖြစ်ယူပြီးclear intent နဲ့tests ကိုဦးစားပေးပါ။
- print(Hello) လို့ quote မထည့်ဘဲရေးရင် Swift က Hello ကို variable name လို့ယူဆပြီး error ပြနိုင်ပါတယ်။
- What is Swift? example ကိုempty, nil, boundary, invalid, error နဲ့cancellation cases ဖြင့်run/test လုပ်ပါ။ Value copy, shared reference, actor isolation နဲ့main-actor effects ကိုလိုအပ်သလိုစစ်ပါ။
Swift 6.2 Released — Swift.org