├── screenshot01.gif ├── screenshot02.gif ├── screenshot03.gif ├── SwiftUI-Particles ├── Assets.xcassets │ ├── Contents.json │ ├── spark.imageset │ │ ├── spark.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── AppDelegate.swift ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── SceneDelegate.swift ├── ParticlesEmitter.swift └── ContentView.swift ├── SwiftUI-Particles.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── project.pbxproj ├── LICENSE ├── README.md └── .gitignore /screenshot01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArthurGuibert/SwiftUI-Particles/HEAD/screenshot01.gif -------------------------------------------------------------------------------- /screenshot02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArthurGuibert/SwiftUI-Particles/HEAD/screenshot02.gif -------------------------------------------------------------------------------- /screenshot03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArthurGuibert/SwiftUI-Particles/HEAD/screenshot03.gif -------------------------------------------------------------------------------- /SwiftUI-Particles/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUI-Particles/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUI-Particles/Assets.xcassets/spark.imageset/spark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArthurGuibert/SwiftUI-Particles/HEAD/SwiftUI-Particles/Assets.xcassets/spark.imageset/spark.png -------------------------------------------------------------------------------- /SwiftUI-Particles.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUI-Particles.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUI-Particles/Assets.xcassets/spark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "spark.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Arthur 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI-Particles 2 | Playing with particles with SwiftUI ✨ 3 | 4 | 5 | ## Screenshot/Preview 6 | 7 | 8 | 9 | 10 | ## How to use 11 | 12 | Just use the the `ParticlesEmitter` class in your project as follow: 13 | 14 | ```swift 15 | struct ContentView: View { 16 | var body: some View { 17 | ParticlesEmitter { 18 | EmitterCell() 19 | .content(.circle(1.0)) 20 | .color(.white) 21 | .lifetime(20) 22 | .birthRate(5) 23 | .velocity(100) 24 | .scaleSpeed(-0.2) 25 | .yAcceleration(100) 26 | } 27 | .emitterSize(.init(width: 64, height: 8)) 28 | .emitterShape(.rectangle) 29 | } 30 | } 31 | ``` 32 | 33 | You can check out the example class in the project `ContentView.swift` for some emitter samples. 34 | 35 | ## References 36 | Useful resources that I used for this small project: 37 | * [CAEmitterLayer official documentation](https://developer.apple.com/documentation/quartzcore/caemitterlayer) 38 | * [NSHipster's CAEmitterLayer Article](https://nshipster.com/caemitterlayer/) 39 | -------------------------------------------------------------------------------- /SwiftUI-Particles/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftUI-Particles 4 | // 5 | // Created by Arthur Guibert on 22/12/2019. 6 | // Copyright © 2019 Arthur Guibert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SwiftUI-Particles/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftUI-Particles/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationPortraitUpsideDown 54 | UIInterfaceOrientationLandscapeLeft 55 | UIInterfaceOrientationLandscapeRight 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /SwiftUI-Particles/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /SwiftUI-Particles/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // SwiftUI-Particles 4 | // 5 | // Created by Arthur Guibert on 22/12/2019. 6 | // Copyright © 2019 Arthur Guibert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Create the SwiftUI view that provides the window contents. 23 | let contentView = ContentView() 24 | 25 | // Use a UIHostingController as window root view controller. 26 | if let windowScene = scene as? UIWindowScene { 27 | let window = UIWindow(windowScene: windowScene) 28 | window.rootViewController = UIHostingController(rootView: contentView) 29 | window.rootViewController?.overrideUserInterfaceStyle = .dark 30 | self.window = window 31 | window.makeKeyAndVisible() 32 | } 33 | } 34 | 35 | func sceneDidDisconnect(_ scene: UIScene) { 36 | // Called as the scene is being released by the system. 37 | // This occurs shortly after the scene enters the background, or when its session is discarded. 38 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 39 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 40 | } 41 | 42 | func sceneDidBecomeActive(_ scene: UIScene) { 43 | // Called when the scene has moved from an inactive state to an active state. 44 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 45 | } 46 | 47 | func sceneWillResignActive(_ scene: UIScene) { 48 | // Called when the scene will move from an active state to an inactive state. 49 | // This may occur due to temporary interruptions (ex. an incoming phone call). 50 | } 51 | 52 | func sceneWillEnterForeground(_ scene: UIScene) { 53 | // Called as the scene transitions from the background to the foreground. 54 | // Use this method to undo the changes made on entering the background. 55 | } 56 | 57 | func sceneDidEnterBackground(_ scene: UIScene) { 58 | // Called as the scene transitions from the foreground to the background. 59 | // Use this method to save data, release shared resources, and store enough scene-specific state information 60 | // to restore the scene back to its current state. 61 | } 62 | 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /SwiftUI-Particles/ParticlesEmitter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParticlesEmitter.swift 3 | // SwiftUI-Particles 4 | // 5 | // Created by Arthur Guibert on 28/10/2019. 6 | // Copyright © 2019 Arthur Guibert. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import UIKit 11 | 12 | 13 | /// Class that wraps the CAEmitterCell in a class compatible with SwiftUI 14 | public struct ParticlesEmitter: UIViewRepresentable { 15 | var center: CGPoint = .zero 16 | var emitterSize: CGSize = .init(width: 1, height: 1) 17 | var shape: CAEmitterLayerEmitterShape = .line 18 | var cells: [CAEmitterCell] = [] 19 | 20 | public func updateUIView(_ uiView: InternalParticlesView, context: UIViewRepresentableContext) { 21 | uiView.emit(from: center, 22 | size: emitterSize, 23 | shape: shape, 24 | cells: cells) 25 | } 26 | 27 | public func makeUIView(context: Context) -> InternalParticlesView { 28 | let view = InternalParticlesView() 29 | view.emit(from: center, 30 | size: emitterSize, 31 | shape: shape, 32 | cells: cells) 33 | return view 34 | } 35 | } 36 | 37 | extension ParticlesEmitter { 38 | func emitterSize(_ size: CGSize) -> Self { 39 | return ParticlesEmitter(center: self.center, emitterSize: size, shape: shape, cells: self.cells) 40 | } 41 | 42 | func emitterPosition(_ position: CGPoint) -> Self { 43 | return ParticlesEmitter(center: position, emitterSize: self.emitterSize, shape: shape, cells: self.cells) 44 | } 45 | 46 | func emitterShape(_ shape: CAEmitterLayerEmitterShape) -> Self { 47 | return ParticlesEmitter(center: self.center, emitterSize: self.emitterSize, shape: shape, cells: self.cells) 48 | } 49 | } 50 | 51 | 52 | /// The container view class for the particles, as the project is using a CAEmitterLayer 53 | public final class InternalParticlesView: UIView { 54 | private var particleEmitter: CAEmitterLayer? 55 | 56 | /// Function that adds the emitter cells to the layer 57 | /// - Parameter center: center of the emitter 58 | /// - Parameter size: size of the emitter 59 | /// - Parameter cells: all the CAEmitterCell 60 | func emit(from center: CGPoint, size: CGSize, shape: CAEmitterLayerEmitterShape, cells: [CAEmitterCell]) { 61 | if particleEmitter == nil { 62 | particleEmitter = CAEmitterLayer() 63 | layer.addSublayer(particleEmitter!) 64 | } 65 | 66 | particleEmitter?.emitterPosition = center 67 | particleEmitter?.emitterShape = shape 68 | particleEmitter?.emitterSize = size 69 | particleEmitter?.emitterCells = cells 70 | } 71 | } 72 | 73 | @_functionBuilder 74 | struct EmitterCellBuilder { 75 | static func buildBlock(_ cells: CAEmitterCell...) -> [CAEmitterCell] { 76 | Array(cells) 77 | } 78 | } 79 | 80 | extension ParticlesEmitter { 81 | init(@EmitterCellBuilder _ content: () -> [CAEmitterCell]) { 82 | self.init(cells: content()) 83 | } 84 | 85 | init(@EmitterCellBuilder _ content: () -> CAEmitterCell) { 86 | self.init(cells: [content()]) 87 | } 88 | } 89 | 90 | class EmitterCell: CAEmitterCell { 91 | override init() { 92 | super.init() 93 | } 94 | 95 | required init?(coder: NSCoder) { 96 | super.init(coder: coder) 97 | } 98 | 99 | func copyEmitter() -> EmitterCell { 100 | return super.copy() as! EmitterCell 101 | } 102 | } 103 | 104 | 105 | extension EmitterCell { 106 | /// Content for the emitter cell, it is either an image, or a circle. 107 | /// NB: It could easily be extended for other shapes. 108 | public enum Content { 109 | case image(UIImage) 110 | case circle(CGFloat) 111 | } 112 | 113 | @inlinable func content(_ content: Content) -> Self { 114 | self.contents = content.image.cgImage 115 | return self 116 | } 117 | 118 | @inlinable func birthRate(_ birthRate: Float) -> Self { 119 | self.birthRate = birthRate 120 | return self 121 | } 122 | 123 | @inlinable func lifetime(_ lifetime: Float) -> Self { 124 | self.lifetime = lifetime 125 | return self 126 | } 127 | 128 | @inlinable func scale(_ scale: CGFloat) -> Self { 129 | self.scale = scale 130 | return self 131 | } 132 | 133 | @inlinable func scaleRange(_ scaleRange: CGFloat) -> Self { 134 | self.scaleRange = scaleRange 135 | return self 136 | } 137 | 138 | @inlinable func scaleSpeed(_ scaleSpeed: CGFloat) -> Self { 139 | self.scaleSpeed = scaleSpeed 140 | return self 141 | } 142 | 143 | @inlinable func velocity(_ velocity: CGFloat) -> Self { 144 | self.velocity = velocity 145 | return self 146 | } 147 | 148 | @inlinable func velocityRange(_ velocityRange: CGFloat) -> Self { 149 | self.velocityRange = velocityRange 150 | return self 151 | } 152 | 153 | @inlinable func emissionLongitude(_ emissionLongitude: CGFloat) -> Self { 154 | self.emissionLongitude = emissionLongitude 155 | return self 156 | } 157 | 158 | @inlinable func emissionLatitude(_ emissionLatitude: CGFloat) -> Self { 159 | self.emissionLatitude = emissionLatitude 160 | return self 161 | } 162 | 163 | @inlinable func emissionRange(_ emissionRange: CGFloat) -> Self { 164 | self.emissionRange = emissionRange 165 | return self 166 | } 167 | 168 | @inlinable func spin(_ spin: CGFloat) -> Self { 169 | self.spin = spin 170 | return self 171 | } 172 | 173 | @inlinable func spinRange(_ spinRange: CGFloat) -> Self { 174 | self.spinRange = spinRange 175 | return self 176 | } 177 | 178 | @inlinable func color(_ color: UIColor) -> Self { 179 | self.color = color.cgColor 180 | return self 181 | } 182 | 183 | @inlinable func xAcceleration(_ xAcceleration: CGFloat) -> Self { 184 | self.xAcceleration = xAcceleration 185 | return self 186 | } 187 | 188 | @inlinable func yAcceleration(_ yAcceleration: CGFloat) -> Self { 189 | self.yAcceleration = yAcceleration 190 | return self 191 | } 192 | 193 | @inlinable func zAcceleration(_ zAcceleration: CGFloat) -> Self { 194 | self.zAcceleration = zAcceleration 195 | return self 196 | } 197 | 198 | @inlinable func alphaSpeed(_ alphaSpeed: Float) -> Self { 199 | self.alphaSpeed = alphaSpeed 200 | return self 201 | } 202 | 203 | @inlinable func alphaRange(_ alphaRange: Float) -> Self { 204 | self.alphaRange = alphaRange 205 | return self 206 | } 207 | } 208 | 209 | fileprivate extension EmitterCell.Content { 210 | var image: UIImage { 211 | switch self { 212 | case let .image(image): 213 | return image 214 | case let .circle(radius): 215 | let size = CGSize(width: radius * 2, height: radius * 2) 216 | return UIGraphicsImageRenderer(size: size).image { context in 217 | context.cgContext.setFillColor(UIColor.white.cgColor) 218 | context.cgContext.addPath(CGPath(ellipseIn: CGRect(origin: .zero, size: size), transform: nil)) 219 | context.cgContext.fillPath() 220 | } 221 | } 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /SwiftUI-Particles/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUI-Particles 4 | // 5 | // Created by Arthur Guibert on 22/12/2019. 6 | // Copyright © 2019 Arthur Guibert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | struct EmitterConfig: Identifiable { 13 | let emitter: ParticlesEmitter 14 | let size: CGSize 15 | let shape: CAEmitterLayerEmitterShape 16 | let position: CGPoint 17 | let name: String 18 | let backgroundColor: Color 19 | 20 | // To make the ForEach work 21 | let id = UUID() 22 | } 23 | 24 | 25 | struct ContentView: View { 26 | struct Constants { 27 | static let height: CGFloat = 230.0 28 | static let width: CGFloat = UIScreen.main.bounds.width 29 | } 30 | 31 | var items: [EmitterConfig] = [ 32 | EmitterConfig(emitter: Emitters.rain, 33 | size: CGSize(width: Constants.width, height: 1), 34 | shape: .line, 35 | position: CGPoint(x: Constants.width / 2, y: 0), 36 | name: "Rain", 37 | backgroundColor: Color(red: 0.1, green: 0.1, blue: 0.5)), 38 | 39 | EmitterConfig(emitter: Emitters.snow, 40 | size: CGSize(width: Constants.width, height: 1), 41 | shape: .line, 42 | position: CGPoint(x: Constants.width / 2, y: 0), 43 | name: "Snow", 44 | backgroundColor: .black), 45 | 46 | EmitterConfig(emitter: Emitters.starField, 47 | size: CGSize(width: 1, height: 1), 48 | shape: .rectangle, 49 | position: CGPoint(x: Constants.width / 2, y: Constants.height / 2), 50 | name: "Star Field", 51 | backgroundColor: .black), 52 | 53 | EmitterConfig(emitter: Emitters.fire, 54 | size: CGSize(width: Constants.width / 8, height: 1), 55 | shape: .line, 56 | position: CGPoint(x: Constants.width / 2, y: Constants.height), 57 | name: "Fire", 58 | backgroundColor: .black), 59 | 60 | EmitterConfig(emitter: Emitters.smoke, 61 | size: CGSize(width: 32, height: 1), 62 | shape: .line, 63 | position: CGPoint(x: Constants.width / 2, y: Constants.height + 20), 64 | name: "Smoke", 65 | backgroundColor: .black), 66 | 67 | EmitterConfig(emitter: Emitters.stars, 68 | size: CGSize(width: Constants.width, height: Constants.height), 69 | shape: .rectangle, 70 | position: CGPoint(x: Constants.width / 2, y: Constants.height / 2), 71 | name: "Stars", 72 | backgroundColor: .black), 73 | 74 | EmitterConfig(emitter: Emitters.explosion, 75 | size: CGSize(width: 16, height: 16), 76 | shape: .rectangle, 77 | position: CGPoint(x: Constants.width / 2, y: Constants.height / 2), 78 | name: "Explosion", 79 | backgroundColor: .black), 80 | ] 81 | 82 | var body: some View { 83 | NavigationView { 84 | List { 85 | ForEach(items) { item in 86 | EmitterItem(config: item) 87 | .listRowBackground(Color(red: 0.1, green: 0.1, blue: 0.1)) 88 | } 89 | } 90 | .navigationBarTitle(Text("Examples")) 91 | } 92 | } 93 | 94 | init() { 95 | UITableView.appearance().separatorStyle = .none 96 | UITableView.appearance().backgroundColor = UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 1.0) 97 | } 98 | } 99 | 100 | struct ContentView_Previews: PreviewProvider { 101 | static var previews: some View { 102 | ContentView() 103 | } 104 | } 105 | 106 | struct EmitterItem: View { 107 | var config: EmitterConfig 108 | 109 | var body: some View { 110 | ZStack(alignment: .leading) { 111 | Color(red: 0.15, green: 0.15, blue: 0.15) 112 | .cornerRadius(12) 113 | .padding(.top, 16) 114 | .padding(.leading, 0) 115 | 116 | VStack(alignment: .leading) { 117 | config.emitter 118 | .emitterSize(config.size) 119 | .emitterShape(config.shape) 120 | .emitterPosition(config.position) 121 | .frame(minWidth: 0, 122 | maxWidth: .infinity, 123 | minHeight: ContentView.Constants.height, 124 | maxHeight: .infinity, 125 | alignment: Alignment.topLeading) 126 | .background(config.backgroundColor) 127 | .cornerRadius(12) 128 | 129 | Text(config.name) 130 | .font(.caption) 131 | .foregroundColor(Color(red: 0.6, green: 0.6, blue: 0.6)) 132 | .padding(.leading, 16) 133 | } 134 | .padding(.trailing, 0) 135 | .padding(.bottom, 8) 136 | } 137 | .padding(.bottom, 16) 138 | .padding(.top, 16) 139 | } 140 | } 141 | 142 | 143 | struct Emitters { 144 | static let snow = ParticlesEmitter { 145 | EmitterCell() 146 | .content(.image(UIImage(named: "spark")!)) 147 | .color(.white) 148 | .lifetime(10) 149 | .birthRate(5) 150 | .scale(0.1) 151 | .scaleRange(0.06) 152 | .scaleSpeed(-0.02) 153 | .velocity(100) 154 | .velocityRange(50) 155 | .emissionLongitude(.pi) 156 | .emissionRange(.pi / 8) 157 | .spin(2) 158 | .spinRange(3) 159 | } 160 | 161 | static let rain = ParticlesEmitter { 162 | EmitterCell() 163 | .content(.circle(8.0)) 164 | .color(UIColor.white.withAlphaComponent(0.5)) 165 | .lifetime(10) 166 | .birthRate(30) 167 | .scale(0.1) 168 | .scaleRange(0.06) 169 | .velocity(200) 170 | .velocityRange(50) 171 | .yAcceleration(200.0) 172 | .emissionLongitude(.pi) 173 | } 174 | 175 | static let starField = ParticlesEmitter { 176 | EmitterCell() 177 | .content(.circle(16.0)) 178 | .color(UIColor.white.withAlphaComponent(0.0)) 179 | .lifetime(10) 180 | .birthRate(40) 181 | .scale(0.01) 182 | .scaleRange(0.004) 183 | .scaleSpeed(0.005) 184 | .alphaSpeed(0.3) 185 | .velocity(100) 186 | .emissionRange(-.pi) 187 | } 188 | 189 | static var fire: ParticlesEmitter { 190 | get { 191 | let base = EmitterCell() 192 | .content(.circle(16.0)) 193 | .color(.white) 194 | .lifetime(2) 195 | .birthRate(50) 196 | .scale(0.1) 197 | .scaleRange(0.06) 198 | .scaleSpeed(-0.05) 199 | .velocity(-50) 200 | .velocityRange(20) 201 | .yAcceleration(20) 202 | .emissionLongitude(.pi) 203 | .emissionRange(.pi / 16) 204 | .alphaRange(0.5) 205 | .alphaSpeed(-0.4) 206 | 207 | return ParticlesEmitter { 208 | base.copyEmitter().color(.yellow) 209 | base.copyEmitter().color(.white) 210 | base.copyEmitter().color(.orange) 211 | base.copyEmitter().color(.red) 212 | } 213 | } 214 | } 215 | 216 | static var smoke: ParticlesEmitter { 217 | get { 218 | let base = EmitterCell() 219 | .content(.circle(16.0)) 220 | .color(.white) 221 | .lifetime(5) 222 | .birthRate(10) 223 | .scale(0.1) 224 | .scaleRange(0.06) 225 | .scaleSpeed(0.025) 226 | .velocity(-60) 227 | .velocityRange(20) 228 | .emissionLongitude(.pi) 229 | .emissionRange(.pi / 16) 230 | .alphaRange(1.0) 231 | .alphaSpeed(-0.5) 232 | 233 | return ParticlesEmitter { 234 | base.copyEmitter().color(.white) 235 | base.copyEmitter().color(.gray) 236 | base.copyEmitter().color(.darkGray) 237 | base.copyEmitter().color(.lightGray) 238 | } 239 | } 240 | } 241 | 242 | static let stars = ParticlesEmitter { 243 | EmitterCell() 244 | .content(.image(UIImage(named: "spark")!)) 245 | .color(UIColor.white.withAlphaComponent(0.0)) 246 | .lifetime(20) 247 | .birthRate(2) 248 | .scale(0.1) 249 | .scaleRange(0.01) 250 | .scaleSpeed(-0.005) 251 | .alphaSpeed(0.3) 252 | } 253 | 254 | static var explosion: ParticlesEmitter { 255 | get { 256 | let base = EmitterCell() 257 | .content(.circle(16.0)) 258 | .color(.white) 259 | .lifetime(0.5) 260 | .birthRate(2) 261 | .scale(0.15) 262 | .scaleRange(0.01) 263 | .scaleSpeed(-0.3) 264 | .velocity(50) 265 | .velocityRange(30) 266 | .emissionRange(-.pi) 267 | 268 | let center = EmitterCell() 269 | .content(.circle(16.0)) 270 | .color(.white) 271 | .lifetime(0.08) 272 | .birthRate(2) 273 | .scale(0.1) 274 | .scaleRange(-0.05) 275 | .scaleSpeed(0.05) 276 | 277 | return ParticlesEmitter { 278 | base.copyEmitter().color(.white) 279 | base.copyEmitter().color(.gray) 280 | base.copyEmitter().color(.darkGray) 281 | base.copyEmitter().color(.lightGray) 282 | base.copyEmitter().color(.white) 283 | base.copyEmitter().color(.gray) 284 | base.copyEmitter().color(.darkGray) 285 | base.copyEmitter().color(.lightGray) 286 | center.copyEmitter().color(.white) 287 | center.copyEmitter().color(.white) 288 | center.copyEmitter().color(.white) 289 | } 290 | } 291 | } 292 | } 293 | -------------------------------------------------------------------------------- /SwiftUI-Particles.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8E4CAB0E23AFD53800B55B15 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E4CAB0D23AFD53800B55B15 /* AppDelegate.swift */; }; 11 | 8E4CAB1023AFD53800B55B15 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E4CAB0F23AFD53800B55B15 /* SceneDelegate.swift */; }; 12 | 8E4CAB1223AFD53800B55B15 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E4CAB1123AFD53800B55B15 /* ContentView.swift */; }; 13 | 8E4CAB1423AFD53B00B55B15 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8E4CAB1323AFD53B00B55B15 /* Assets.xcassets */; }; 14 | 8E4CAB1723AFD53B00B55B15 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8E4CAB1623AFD53B00B55B15 /* Preview Assets.xcassets */; }; 15 | 8E4CAB1A23AFD53B00B55B15 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8E4CAB1823AFD53B00B55B15 /* LaunchScreen.storyboard */; }; 16 | 8E4CAB2223AFD55B00B55B15 /* ParticlesEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E4CAB2123AFD55B00B55B15 /* ParticlesEmitter.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 8E4CAB0A23AFD53800B55B15 /* SwiftUI-Particles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftUI-Particles.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 8E4CAB0D23AFD53800B55B15 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 8E4CAB0F23AFD53800B55B15 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 23 | 8E4CAB1123AFD53800B55B15 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 24 | 8E4CAB1323AFD53B00B55B15 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 8E4CAB1623AFD53B00B55B15 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 26 | 8E4CAB1923AFD53B00B55B15 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 8E4CAB1B23AFD53B00B55B15 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 8E4CAB2123AFD55B00B55B15 /* ParticlesEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticlesEmitter.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 8E4CAB0723AFD53800B55B15 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 8E4CAB0123AFD53700B55B15 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 8E4CAB0C23AFD53800B55B15 /* SwiftUI-Particles */, 46 | 8E4CAB0B23AFD53800B55B15 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 8E4CAB0B23AFD53800B55B15 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 8E4CAB0A23AFD53800B55B15 /* SwiftUI-Particles.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 8E4CAB0C23AFD53800B55B15 /* SwiftUI-Particles */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 8E4CAB0D23AFD53800B55B15 /* AppDelegate.swift */, 62 | 8E4CAB0F23AFD53800B55B15 /* SceneDelegate.swift */, 63 | 8E4CAB1123AFD53800B55B15 /* ContentView.swift */, 64 | 8E4CAB2123AFD55B00B55B15 /* ParticlesEmitter.swift */, 65 | 8E4CAB1323AFD53B00B55B15 /* Assets.xcassets */, 66 | 8E4CAB1823AFD53B00B55B15 /* LaunchScreen.storyboard */, 67 | 8E4CAB1B23AFD53B00B55B15 /* Info.plist */, 68 | 8E4CAB1523AFD53B00B55B15 /* Preview Content */, 69 | ); 70 | path = "SwiftUI-Particles"; 71 | sourceTree = ""; 72 | }; 73 | 8E4CAB1523AFD53B00B55B15 /* Preview Content */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 8E4CAB1623AFD53B00B55B15 /* Preview Assets.xcassets */, 77 | ); 78 | path = "Preview Content"; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | 8E4CAB0923AFD53800B55B15 /* SwiftUI-Particles */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = 8E4CAB1E23AFD53B00B55B15 /* Build configuration list for PBXNativeTarget "SwiftUI-Particles" */; 87 | buildPhases = ( 88 | 8E4CAB0623AFD53800B55B15 /* Sources */, 89 | 8E4CAB0723AFD53800B55B15 /* Frameworks */, 90 | 8E4CAB0823AFD53800B55B15 /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = "SwiftUI-Particles"; 97 | productName = "SwiftUI-Particles"; 98 | productReference = 8E4CAB0A23AFD53800B55B15 /* SwiftUI-Particles.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | 8E4CAB0223AFD53700B55B15 /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastSwiftUpdateCheck = 1110; 108 | LastUpgradeCheck = 1110; 109 | ORGANIZATIONNAME = "Arthur Guibert"; 110 | TargetAttributes = { 111 | 8E4CAB0923AFD53800B55B15 = { 112 | CreatedOnToolsVersion = 11.1; 113 | }; 114 | }; 115 | }; 116 | buildConfigurationList = 8E4CAB0523AFD53700B55B15 /* Build configuration list for PBXProject "SwiftUI-Particles" */; 117 | compatibilityVersion = "Xcode 9.3"; 118 | developmentRegion = en; 119 | hasScannedForEncodings = 0; 120 | knownRegions = ( 121 | en, 122 | Base, 123 | ); 124 | mainGroup = 8E4CAB0123AFD53700B55B15; 125 | productRefGroup = 8E4CAB0B23AFD53800B55B15 /* Products */; 126 | projectDirPath = ""; 127 | projectRoot = ""; 128 | targets = ( 129 | 8E4CAB0923AFD53800B55B15 /* SwiftUI-Particles */, 130 | ); 131 | }; 132 | /* End PBXProject section */ 133 | 134 | /* Begin PBXResourcesBuildPhase section */ 135 | 8E4CAB0823AFD53800B55B15 /* Resources */ = { 136 | isa = PBXResourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 8E4CAB1A23AFD53B00B55B15 /* LaunchScreen.storyboard in Resources */, 140 | 8E4CAB1723AFD53B00B55B15 /* Preview Assets.xcassets in Resources */, 141 | 8E4CAB1423AFD53B00B55B15 /* Assets.xcassets in Resources */, 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | /* End PBXResourcesBuildPhase section */ 146 | 147 | /* Begin PBXSourcesBuildPhase section */ 148 | 8E4CAB0623AFD53800B55B15 /* Sources */ = { 149 | isa = PBXSourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 8E4CAB0E23AFD53800B55B15 /* AppDelegate.swift in Sources */, 153 | 8E4CAB2223AFD55B00B55B15 /* ParticlesEmitter.swift in Sources */, 154 | 8E4CAB1023AFD53800B55B15 /* SceneDelegate.swift in Sources */, 155 | 8E4CAB1223AFD53800B55B15 /* ContentView.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin PBXVariantGroup section */ 162 | 8E4CAB1823AFD53B00B55B15 /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | 8E4CAB1923AFD53B00B55B15 /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | 8E4CAB1C23AFD53B00B55B15 /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 200 | CLANG_WARN_STRICT_PROTOTYPES = YES; 201 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 203 | CLANG_WARN_UNREACHABLE_CODE = YES; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | COPY_PHASE_STRIP = NO; 206 | DEBUG_INFORMATION_FORMAT = dwarf; 207 | ENABLE_STRICT_OBJC_MSGSEND = YES; 208 | ENABLE_TESTABILITY = YES; 209 | GCC_C_LANGUAGE_STANDARD = gnu11; 210 | GCC_DYNAMIC_NO_PIC = NO; 211 | GCC_NO_COMMON_BLOCKS = YES; 212 | GCC_OPTIMIZATION_LEVEL = 0; 213 | GCC_PREPROCESSOR_DEFINITIONS = ( 214 | "DEBUG=1", 215 | "$(inherited)", 216 | ); 217 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 218 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 219 | GCC_WARN_UNDECLARED_SELECTOR = YES; 220 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 221 | GCC_WARN_UNUSED_FUNCTION = YES; 222 | GCC_WARN_UNUSED_VARIABLE = YES; 223 | IPHONEOS_DEPLOYMENT_TARGET = 13.1; 224 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 225 | MTL_FAST_MATH = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 230 | }; 231 | name = Debug; 232 | }; 233 | 8E4CAB1D23AFD53B00B55B15 /* Release */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_ANALYZER_NONNULL = YES; 238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_ENABLE_OBJC_WEAK = YES; 244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_COMMA = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu11; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 13.1; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | MTL_FAST_MATH = YES; 280 | SDKROOT = iphoneos; 281 | SWIFT_COMPILATION_MODE = wholemodule; 282 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | 8E4CAB1F23AFD53B00B55B15 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CODE_SIGN_STYLE = Automatic; 292 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-Particles/Preview Content\""; 293 | DEVELOPMENT_TEAM = 5295SCV5S9; 294 | ENABLE_PREVIEWS = YES; 295 | INFOPLIST_FILE = "SwiftUI-Particles/Info.plist"; 296 | LD_RUNPATH_SEARCH_PATHS = ( 297 | "$(inherited)", 298 | "@executable_path/Frameworks", 299 | ); 300 | PRODUCT_BUNDLE_IDENTIFIER = "com.slipcorp.SwiftUI-Particles"; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | SWIFT_VERSION = 5.0; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | }; 305 | name = Debug; 306 | }; 307 | 8E4CAB2023AFD53B00B55B15 /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CODE_SIGN_STYLE = Automatic; 312 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-Particles/Preview Content\""; 313 | DEVELOPMENT_TEAM = 5295SCV5S9; 314 | ENABLE_PREVIEWS = YES; 315 | INFOPLIST_FILE = "SwiftUI-Particles/Info.plist"; 316 | LD_RUNPATH_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "@executable_path/Frameworks", 319 | ); 320 | PRODUCT_BUNDLE_IDENTIFIER = "com.slipcorp.SwiftUI-Particles"; 321 | PRODUCT_NAME = "$(TARGET_NAME)"; 322 | SWIFT_VERSION = 5.0; 323 | TARGETED_DEVICE_FAMILY = "1,2"; 324 | }; 325 | name = Release; 326 | }; 327 | /* End XCBuildConfiguration section */ 328 | 329 | /* Begin XCConfigurationList section */ 330 | 8E4CAB0523AFD53700B55B15 /* Build configuration list for PBXProject "SwiftUI-Particles" */ = { 331 | isa = XCConfigurationList; 332 | buildConfigurations = ( 333 | 8E4CAB1C23AFD53B00B55B15 /* Debug */, 334 | 8E4CAB1D23AFD53B00B55B15 /* Release */, 335 | ); 336 | defaultConfigurationIsVisible = 0; 337 | defaultConfigurationName = Release; 338 | }; 339 | 8E4CAB1E23AFD53B00B55B15 /* Build configuration list for PBXNativeTarget "SwiftUI-Particles" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | 8E4CAB1F23AFD53B00B55B15 /* Debug */, 343 | 8E4CAB2023AFD53B00B55B15 /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | /* End XCConfigurationList section */ 349 | }; 350 | rootObject = 8E4CAB0223AFD53700B55B15 /* Project object */; 351 | } 352 | --------------------------------------------------------------------------------