Guard let nedir , nasıl Kullanılır - Swift

in utopian-io •  7 years ago  (edited)

Selamlar , Bu dersimizde guard let kullanımından ne olduğundan ve kullanımından bahsettim . Genel kodlama şekillerini anlatmaya çalıştım . Önemli konulardan bir tanesidir . Ümid ediyorum ki anlatabilmişimdir . İyi seyirler , iyi dersler .

Greetings, In this lesson I talked about what the guard let is and how to use it. I tried to explain the general coding styles. It is one of the important issues. I hope that I can tell. Good looking, good lessons.



Projemizin Kodları
(Project Code)





import UIKit

**// if let kullanımı  -- Optional ifadelerden kurtulmak için kullanırız**

**// Json Parse işlemi yaparken**

**// if let yada guard let yapısını kullanacağız**

struct Uyeler {

    var name:String?

    var email:String?

    var password:Int?

}

var uyem = Uyeler(name: "Kerim", email: "[email protected]", password: nil)

//func uyeGetir(uye:Uyeler){

//

//    if let name = uye.name, let email = uye.email, let password = uye.password{

//        print(name)

//        print(email)

//        print(password)

//    } else{

//        print("Verileriniz okunamadı")

//    }

//}

**// Guard yapısı hatayı başta yakalar**

func uyeGetir(uye:Uyeler){

    

    guard let name = uye.name, let email = uye.email, let password = uye.password else{

        

        print("Verileriniz okunamadı")

        return

    }

    

    print(name)

    print(email)

    print(password)

}

uyeGetir(uye: uyem)





  • Video ya ingilizce çeviri yapana " 1 SBD " Ödül verilecektir

  • The person who makes video or english translation will be awarded "1 SBD".


Videoma ingilizce çeviri yapabilirsiniz
English subtitles can be added to the video.

Kodlara github adresimden'de ulaşabilirsiniz
You can access the code file from my "Githup" account


Önceki derslerimiz / Previous lessons.**




Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @kerimcaglar I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x