@@ -80,12 +80,12 @@ MyView().roundedBorder(.red, cornerRadius: 5.0, lineWidth: 2.0)
8080 - Hover tooltip modifier (macOS) [ β] ( )
8181 - View mouse position checking (macOS) [ β] ( )
8282- Other Features
83- - Image modifiers [ β ] ( )
83+ - Image modifiers
8484 - Color features [ β] ( )
85- - Quick dividers [ β ] ( )
85+ - Quick dividers
8686 - Visual effects [ β] ( )
87- - Pre-made buttons [ β ] ( )
88- - Action item highlight modifier [ β ] ( )
87+ - Pre-made buttons
88+ - Action item highlight modifier
8989
9090Most of the above features are ** cross-platform** and are supported on both iOS and macOS.
9191
@@ -152,3 +152,169 @@ Spacer.HXS
152152
153153Vertical spacer variants include ` .VXXS ` , ` .VXS ` , ` .VS ` , ` .VM ` , ` .VL ` , ` .VXL ` , and ` .VXXL ` .
154154Horizontal spacer variants include ` .HXXS ` , ` .HXS ` , ` .HS ` , ` .HM ` , ` .HL ` , ` .HXL ` , and ` .HXXL ` .
155+
156+ ## βοΈ View Functionality
157+
158+ ### Operations on views
159+
160+ You can quickly group views using operators:
161+
162+ ``` swift
163+ // Horizontal stack
164+ MyViewA () + MyViewB ()
165+
166+ // Vertical stack, center-aligned
167+ MyViewA () / MyViewB ()
168+
169+ // Vertical stack, left-aligned
170+ MyViewA () /- MyViewB ();
171+ ```
172+
173+ ### View frame modifiers
174+
175+ Easily set the dimensions of a square frame:
176+
177+ ``` swift
178+ // Sets MyView's frame to width = 30.0, height = 30.0
179+ MyView ().frame (30.0 )
180+ ```
181+
182+ Stretch the view:
183+
184+ ``` swift
185+ // Stretch horizontally
186+ MyViewA ().stretchH ()
187+
188+ // Stretch vertically
189+ MyViewB ().stretchV ()
190+
191+ // Stretch in both directions
192+ MyViewC ().stretch ()
193+ ```
194+
195+ ### View refresh modifier
196+
197+ Use a ` @State ` boolean to refresh a view quickly:
198+
199+ ``` swift
200+ @State var refresh: Bool = false
201+
202+ var body {
203+ MyView ().refreshable (with : refresh)
204+ }
205+ ```
206+
207+ Updating the view would require that ` refresh.toggle() ` is called.
208+
209+ ### View styling modifiers
210+
211+ Set the relative opacity of a view:
212+
213+ ``` swift
214+ MyView ().opacity (.half )
215+ ```
216+
217+ You can choose from (in order of opacity) ` .opaque ` , ` .most ` , ` .half ` , ` .quarter ` , ` .almostInvisible ` , ` .invisible ` .
218+
219+ Add a rounded border to any view:
220+
221+ ``` swift
222+ MyViewA ().roundedBorder (.green )
223+ MyViewB ().roundedBorder (.red , cornerRadius : .s , lineWidth : 2.0 )
224+ ```
225+
226+ ### Custom animation/transitions
227+
228+ Add a slick transition to a view using ` .slickAnimation(value:) ` :
229+
230+ ``` swift
231+ MyViewA ().slickAnimation ()
232+ MyViewB ().slickAnimation (value : myVal)
233+ ```
234+
235+ Add a custom built-in animation; i.e. ` .slickEaseOut ` , ` .slickEaseIn ` , ` .rampEaseOut ` , ` .rampEaseIn ` , ` .bounce ` , ` .lightBounce ` , or ` .page ` :
236+
237+ ``` swift
238+ MyViewA ().animation (.rampEaseOut )
239+ MyViewB ().animation (.slickEaseOut (duration : 1.0 ), value : myVal)
240+ ```
241+
242+ Add a custom built-in transition; i.e. ` .turn ` , ` .swipe ` , ` .pop ` :
243+
244+ ``` swift
245+ MyViewA ().transition (.turn )
246+ ```
247+
248+ ### Debugging view modifier
249+
250+ Use the ` .debug() ` view modifier to randomly change the background color of the view for debugging:
251+
252+ ``` swift
253+ MyView ().debug ()
254+ ```
255+
256+ ### Screenshot view method
257+
258+ Take a screenshot of a view and save the image to path:
259+
260+ ``` swift
261+ myView.snapshot ()
262+ ```
263+
264+ ### Hover tooltip modifier (macOS)
265+
266+ Add a tooltip upon hover to a view:
267+
268+ ``` swift
269+ MyView ()
270+ .withTooltip (present : $showTooltip) {
271+ Text (" This is a tooltip!" )
272+ }
273+ ```
274+
275+ Add a keyboard shortcut, which automatically adds the shortcut tooltip:
276+
277+ ``` swift
278+ MyViewA ().shortcut (" c" , modifiers : [.shift , .command ])
279+ MyViewB ().shortcut (.defaultAction )
280+ ```
281+
282+ ### View mouse position checking (macOS)
283+
284+ Track the relative position of the mouse pointer within the view:
285+
286+ ``` swift
287+ MyView ().trackingMouse { pos in
288+ // ...
289+ }
290+ ```
291+
292+ ## π Other Features
293+
294+ ### Color features
295+
296+ Take advantage of color utilities:
297+
298+ ``` swift
299+ // Init color from hex code
300+ var color = Color (hex : " #ffffff" )
301+
302+ // If bindingBool.wrappedValue is true, show the color
303+ MyView ().foregroundColor (.red .if ($bindingBool))
304+
305+ // Get a lighter version of a color
306+ lighter = color.ligher (by : 0.3 )
307+
308+ // Colors also have relative opacities, just like views
309+ halfColor = color.opacity (.half )
310+ ```
311+
312+ When importing ShinySwiftUI, colors will also conform to ` Codable ` .
313+
314+ ### Visual effects
315+
316+ Easily add SwiftUI wraps of ` UIVisualEffectView ` :
317+
318+ ``` swift
319+ VisualEffectView ()
320+ ```
0 commit comments