Skip to content

Code for the Qiita article on Swift Macro, contains 3 ExpressionMacro (URL, SF Symbol, Xcode demo) and 1 AccessorMacro (access NSUbiquitousKeyValueStore)

Notifications You must be signed in to change notification settings

mszpro/Swift_Macro_Qiita

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Macro - creating custom Macros

This article will talk about creating your own custom Swift Macro. It will cover 2 types of Macros: ExpressionMacro which helps you expand and help you write an expression; and AccessorMacro which adds set and get to a variable. It has some examples:

  • Verify SF Symbol name and convert it to SwiftUI Image (or throw compile error if name is invalid)
  • Verifies if String is valid URL and then convert it to URL object (or throw compile time error)
  • Bind the value of a variable to that on iCloud key-value storage

Read article

https://articles.mszpro.com/creating-custom-swift-macros-with-examples-sf-symbol-url-validator-icloud-key-value-store-34014814c806

https://mszpro.com/blog/swift-macro/

https://qiita.com/mashunzhe/items/40a5b1270c514606adcc

About

Code for the Qiita article on Swift Macro, contains 3 ExpressionMacro (URL, SF Symbol, Xcode demo) and 1 AccessorMacro (access NSUbiquitousKeyValueStore)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages